using System;

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

            if (x1 == x2 || y1 == y2)
            {
                Console.WriteLine(2);
                Console.ReadKey();
                return;
            }

            if (Math.Abs(x2 - x1) != Math.Abs(y2 - y1))
            {
                Console.WriteLine(0);
                Console.ReadKey();
                return;
            }
            else {
                Console.WriteLine(1);
                Console.ReadKey();
                return;
            }
        }
    }
}