using System;

namespace takmiceje_1._zadatak
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s1 = Console.ReadLine().Split(' ');
            int x1 = int.Parse(s1[0]);
            int y1 = int.Parse(s1[1]);
            string[] s2 = Console.ReadLine().Split(' ');
            int x2 = int.Parse(s2[0]);
            int y2 = int.Parse(s2[1]);
            if (Math.Abs(x1 - x2) == Math.Abs(y1 - y2)) Console.WriteLine(1);
            else if (x1 == x2 || y1 == y2) Console.WriteLine(2);
            else Console.WriteLine(0);
        }
    }
}