using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp78
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int x = int.Parse(s[0]);
            int y = int.Parse(s[1]);
            s = Console.ReadLine().Split();
            int x1 = int.Parse(s[0]);
            int y1 = int.Parse(s[1]);
            if ((x == x1 && y == y1) || (Math.Abs(x - x1) != Math.Abs(y - y1)))
                Console.WriteLine(0);
            else
            {
                if ((x == x1 || y == y1) && !(x == x1 && y == y1))
                    Console.WriteLine(2);
                else if (Math.Abs(x - x1) == Math.Abs(y - y1))
                    Console.WriteLine(1);
            }
        }
    }
}