using System;

namespace Zadatak1
{
    class Program
    {
        static void Main(string[] args)
        {
            double x1, x2, y1, y2;
            string[] s = Console.ReadLine().Split();
            x1 = double.Parse(s[0]);
            y1 = double.Parse(s[1]);
            string[] c = Console.ReadLine().Split();
            x2 = double.Parse(c[0]);
            y2 = double.Parse(c[1]);
            if (x1 == x2 && y1 == y2)
            {
                Console.WriteLine(0);
            }
            else
            {
                if (x1 == x2 || y1 == y2)
                {
                    Console.WriteLine(2);
                }
                else
                    Console.WriteLine(1);
            }
        }
    }
}