using System;

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

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




        }
    }
}