using System;

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