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

namespace _A_Kvadrati
{
    class Program
    {
        static void Main(string[] args)
        {

            int x1, x2, y1, y2, n;

            var ulaz = Console.ReadLine().Split();

            x1 = int.Parse(ulaz[0]);
            y1 = int.Parse(ulaz[1]);

            ulaz = Console.ReadLine().Split();

            x2 = int.Parse(ulaz[0]);
            y2 = int.Parse(ulaz[1]);

            if (x1 == x2 || y1 == y2)
            {
                n = 2;
            }
            else
            {
                n = 1;
            }

            Console.WriteLine(n);

        }
    }
}