using System;

namespace _1ZAD
{
    class Program
    {
        static void Main(string[] args)
        {
            int x1, x2, y1, y2,b=0;
            string[] niz = Console.ReadLine().Split();
            x1 = int.Parse(niz[0]);
            y1 = int.Parse(niz[1]);
            string[] niz1 = Console.ReadLine().Split();
            x2 = int.Parse(niz1[0]);
            y2 = int.Parse(niz1[1]);
            if ((x1 == x2) || (y1 == y2))
            {
                b = 2;
            }
            if ((Math.Abs(x1 - x2) == Math.Abs(y1 - y2)) && x1 != x2 && y1 != y2)
            {
                b = 1;
            }
            Console.WriteLine(b);
        }
    }
}