using System;

namespace Kvadrati
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ulaz1 = Console.ReadLine().Split(" ");
            int x1 = int.Parse(ulaz1[0]);
            int y1 = int.Parse(ulaz1[1]);
            string[] ulaz2 = Console.ReadLine().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 ((y1 == y2) || (x1 == x2))
            {
                Console.WriteLine("2");
            }
            else
            {
                Console.WriteLine("1");
            }
        }
    }
}