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

namespace ConsoleApplication85
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] tokens = Console.ReadLine().Split();
            int x = int.Parse(tokens[0]);
            int y = int.Parse(tokens[1]);
            string[] tokens1 = Console.ReadLine().Split();
            int x1 = int.Parse(tokens[0]);
            int y1 = int.Parse(tokens[1]);
            if (x == x1 )
            {
                Console.WriteLine("2");

            }
            else if (y == y1)
            {
                Console.WriteLine("2");
            }
            else
            {
                Console.WriteLine("1");
            }
            Console.ReadKey();
        }
    }
}