using System;

namespace kako_je_kvadrat
{
    class Program
    {
        static void Main(string[] args)
        {
            int ax, ay, bx, by;

            string[] s = Console.ReadLine().Split();
            ax = int.Parse(s[0]);
            ay = int.Parse(s[1]);
            s = Console.ReadLine().Split();
            bx = int.Parse(s[0]);
            by = int.Parse(s[1]);
            if (ax == bx || ay == by) Console.WriteLine(2);
            else if (Math.Abs(ax - bx) == Math.Abs(ay - by)) Console.WriteLine(1);
            else Console.WriteLine(0);
        }
    }
}