using System;


namespace ConsoleApp2
{
    class Program
    {

        static void Main(string[] args)
        {
            string[] niz = Console.ReadLine().Split();
            int x1 = int.Parse(niz[0]);
            int y1 = int.Parse(niz[1]);
            niz = Console.ReadLine().Split();
            int x2 = int.Parse(niz[0]);
            int y2 = int.Parse(niz[1]);
            int kv=0;
            if (x1 == x2 || y1 == y2)
            {
                kv = 2;
            }
            else
                if (Math.Abs(x1 - x2) == Math.Abs(y1 - y2))
                {
                kv = 1;
                }
            Console.WriteLine(kv);
        }
    } 
    }