using System;

namespace KVADRATI
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int x1 = int.Parse(s[0]);
            int y1 = int.Parse(s[1]);
            s = Console.ReadLine().Split();
            int x2 = int.Parse(s[0]);
            int y2 = int.Parse(s[1]);

            if (x1 == x2)
                Console.WriteLine("2");
            else if(y1 == y2)
                Console.WriteLine("2");
            else
            {
                long a = (x1 > x2) ? x1 - x2 : x2 - x1;
                long b = (y1 > y2) ? y1 - y2 : y2 - y1;

                if (a != b)
                    Console.WriteLine("0");
                else
                {
                    Console.WriteLine("1");
                }
            }
        }
    }
}