using System;
using System.Linq;

namespace zadatak1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] prvaTacka = Console.ReadLine().Split();
            long x1 = long.Parse(prvaTacka[0]);
            long y1 = long.Parse(prvaTacka[1]);
            string[] drugaTacka = Console.ReadLine().Split();
            long x2 = long.Parse(drugaTacka[0]);
            long y2 = long.Parse(drugaTacka[1]);
            long br = 0;
            if (x1 == x2 || y1 == y2)
            {
                br = 2;
            }
            else
            if (Math.Abs(x1 - x2) == Math.Abs(y1 - y2))
            {
                br = 1;
            }
            Console.WriteLine(br);
        }
    }
}