using System;
namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] PrviUlaz = Console.ReadLine().Split();
            int x1 = int.Parse(PrviUlaz[0]);
            int y1 = int.Parse(PrviUlaz[1]);
            string[] DrugiUlaz = Console.ReadLine().Split();
            int x2 = int.Parse(DrugiUlaz[0]);
            int y2 = int.Parse(DrugiUlaz[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);
        }
    }
}