using System;

namespace _1_kvadrati
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] A = Console.ReadLine().Split(' ');
            string[] B = Console.ReadLine().Split(' ');

            int Ax = Convert.ToInt32(A[0]);
            int Ay = Convert.ToInt32(A[1]);

            int Bx = Convert.ToInt32(B[0]);
            int By = Convert.ToInt32(B[1]);

            if ((Ax == Bx) || (Ay == By))
            {
                Console.WriteLine(2);
            }
            else
            if ((Ax - Bx) - (Ay - By) == 0)
            {
                Console.WriteLine(1);
            }
            else
            {
                Console.WriteLine(0);
            }
        }
    }
}