using System;

namespace Kvadrati
{
    class Program
    {
        static void Main(string[] args)
        {
            string prviUlaz = Console.ReadLine();
            string[] ulaz1 = prviUlaz.Split(' ');
            int x1 = int.Parse(ulaz1[0]);
            int y1 = int.Parse(ulaz1[1]);

            string drugiUlaz = Console.ReadLine();
            string[] ulaz2 = drugiUlaz.Split(' ');
            int x2 = int.Parse(ulaz2[0]);
            int y2 = int.Parse(ulaz2[1]);
            if (x1 == y1 && x2 != y2)
            {
                Console.WriteLine("0");
            }
            else if (x2 == y2 && x1 != y1)
            {
                Console.WriteLine("0");
            }
            else if (x1==y1 && x2==y2)
            {
                Console.WriteLine("1");
            }
            else if ((y1 == y2) || (x1 == x2))
            {
                Console.WriteLine("2");
            }
            else
            {
                Console.WriteLine("0");
            }
        }
    }
}