using System;

namespace kvalifikacije2
{
    class Program
    {
        static void Main(string[] args)
        {
            int br = 0;
            string[] niz = Console.ReadLine().Split();
            int x1 = Int32.Parse(niz[0]);
            int y1 = Int32.Parse(niz[1]);
            string[] niz2 = Console.ReadLine().Split();
            int x2 = Int32.Parse(niz2[0]);
            int y2 = Int32.Parse(niz2[1]);
            if (x1 == x2 || y1 == y2)
                br = 2;
            else
                if(Math.Abs(x1-x2)==Math.Abs(y1-y2))
                    br = 1;
            Console.WriteLine(br);
        }
    }
}