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

namespace petilja_1feladat
{
    class Program
    {
        static void Main(string[] args)
        {
            string elso = Console.ReadLine();
            string masodik = Console.ReadLine();
            string[] tomb1 = elso.Split(' ');
            string[] tomb2 = masodik.Split(' ');
            int x1 = Convert.ToInt32(tomb1[0]);
            int x2 = Convert.ToInt32(tomb2[0]);
            int y1 = Convert.ToInt32(tomb1[1]);
            int y2 = Convert.ToInt32(tomb2[1]);
            if(x1==x2 || y1 == y2)
            {
                Console.WriteLine("2");
            }
            else
            {
                Console.WriteLine("1");
            }
        }
    }
}