using System;

namespace takmicenje
{
    class Program
    {
        static void Main(string[] args)
        {
            int x1, x2, y1, y2;

            //Koordinate prvog
            string input = Console.ReadLine();
            string[] d = input.Split(' ');
            x1 = int.Parse(d[0]);
            y1 = int.Parse(d[1]);

            //Koordinate drugog
            input = Console.ReadLine();
            d = input.Split(' ');
            x2 = int.Parse(d[0]);
            y2 = int.Parse(d[1]);

            if (x1 == x2 || y1 == y2)
            {
                Console.WriteLine("2");
            } else if (Math.Abs(x1 - x2) == Math.Abs(y1 - y2))
            {
                Console.WriteLine("1");
            }
            else
            {
                Console.WriteLine("0");
            }

            
        }
    }
}