using System;

namespace Zadatak1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] tacke = new int[2, 2];

            for (int i = 0; i < 2; i++)
            {
                string[] input = Console.ReadLine().Split(' ');
                tacke[i, 0] = Convert.ToInt32(input[0]);
                tacke[i, 1] = Convert.ToInt32(input[1]);
            }

            if (tacke[0, 0] == tacke[1, 0] || tacke[0, 1] == tacke[1, 1])
            {
                Console.WriteLine(2);

            }
            else if (Math.Abs(tacke[0, 0] - tacke[1, 0]) != Math.Abs(tacke[0, 1] - tacke[1, 1]))
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(1);
            }
        }
    }
}