using System;

namespace Prvi
{
    class Program
    {
        static void Main(string[] args)
        {
            var unos = Console.ReadLine().Split();
            int x1 = int.Parse(unos[0]);
            int y1 = int.Parse(unos[1]); 
            unos = Console.ReadLine().Split();
            int x2 = int.Parse(unos[0]);
            int y2 = int.Parse(unos[1]);
            if (x1 == x2 || y1 == y2)
                Console.WriteLine("2");
            else
                Console.WriteLine("1");
        }
    }
}