using System;

namespace takmicenje_zad_resi
{
    class Program
    {
        static int a(int x1, int x2, int y1, int y2)
        {
            if (x1 == x2 || y1 == y2) return 2;
            else if (Math.Abs(x1 - x2) == Math.Abs(y1 - y2)) return 1;
            return 0;
        }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int x1 = int.Parse(s[0]);
            int y1 = int.Parse(s[1]);
            s = Console.ReadLine().Split();
            int x2 = int.Parse(s[0]);
            int y2 = int.Parse(s[1]);
            Console.WriteLine(a(x1, x2, y1, y2));
        }
    }
}