using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace kvadrati
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            int x1 = int.Parse(line.Split(' ')[0]);
            int y1 = int.Parse(line.Split(' ')[1]);
            line = Console.ReadLine();
            int x2 = int.Parse(line.Split(' ')[0]);
            int y2 = int.Parse(line.Split(' ')[1]);

            if (x1 == x2 || y1 == y2)
            {
                Console.WriteLine(2);
            }

            else
            {
                Console.WriteLine(1);
            }

        }
    }
}