using System;

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