using System;

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

        }
    }
}