using System;

namespace drugi_krug
{
    class Program
    {
        static void Main(string[] args)
        {
            int x1, x2, y1, y2;
            string[] p = Console.ReadLine().Split();
            x1 = Convert.ToInt32(p[0]);
            y1 = Convert.ToInt32(p[1]);
            p = Console.ReadLine().Split();
            x2 = Convert.ToInt32(p[0]);
            y2 = Convert.ToInt32(p[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");
            }
        }
    }
}