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

namespace kvadrati
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int x1 = int.Parse(s[0]);
            int y1 = int.Parse(s[1]);
            string[] t = Console.ReadLine().Split();
            int x2 = int.Parse(t[0]);
            int y2 = int.Parse(t[1]);
            int b = 0;
            if (x1 != x2 && y1 != y2)
            {
                b = 1;
            }
            else if (x1 == x2 && x1 == y1 && x1 == y2)
            {

            }
            else if (x1 == x2 || y1 == y2)
            {
                b = 2;
            }
            Console.WriteLine(b);
        }
    }
}