using System;

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