using System;

namespace petlja
{
    class Program
    {
        static void Main(string[] args)
        {
            string a, b;
            int x1, y1, x2, y2;
            a = Console.ReadLine();
            b = Console.ReadLine();
            string[] prvatacka = a.Split(' ');
            x1 = int.Parse(prvatacka[0]);
            y1 = int.Parse(prvatacka[1]);
            string[] drugatacka = b.Split(' ');
            x2 = int.Parse(drugatacka[0]);
            y2 = int.Parse(drugatacka[1]);
            if (x1 == x2 || y1 == y2)
                Console.WriteLine(2);
            else
            {
                if (Math.Abs(x1 - x2) != Math.Abs(y1 - y2))
                    Console.WriteLine(0);
                else
                    Console.WriteLine(1);
            }
        }
    }
}