using System;

namespace takmicenjekrug2
{
    class Program
    {
        static int Abs(int n)
        {
            if (n > 0) return n;
            else return -1*n;
        }
        static void Main(string[] args)
        {
            int x1, y1, x2, y2;
            string[] s1 = Console.ReadLine().Split();
            x1 = int.Parse(s1[0]);
            y1 = int.Parse(s1[1]);
            s1 = Console.ReadLine().Split();
            x2 = int.Parse(s1[0]);
            y2 = int.Parse(s1[1]);

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