using System;

namespace ConsoleApp14
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
            int x1 = Convert.ToInt32(unos[0]);
            int y1 = Convert.ToInt32(unos[1]);
            unos = Console.ReadLine().Split();
            int x2 = Convert.ToInt32(unos[0]);
            int y2 = Convert.ToInt32(unos[1]);
            bool moze = true;
            if (Math.Abs(x2 - x1) == Math.Abs(y2 - y1))
            {
                Console.WriteLine("1");
                moze = false;
            }
            if (x2==x1 && y2!=y1)
            {
                Console.WriteLine("2");
                moze = false;
            }
            if (y2==y1 && x2!=x1)
            {
                Console.WriteLine("2");
                moze = false;
            }
            if (moze == true) Console.WriteLine("0");
        }
    }
}