using System;

namespace petlja_2020_2_1
{
    class Program
    {
        static void Main(string[] args)
        {
            short x1;
            short y1;
            {
                string s = Console.ReadLine();
                string[] ss = s.Split(' ');
                x1 = Convert.ToInt16(ss[0]);
                y1 = Convert.ToInt16(ss[1]);
            }
            short x2;
            short y2;
            {
                string s = Console.ReadLine();
                string[] ss = s.Split(' ');
                x2 = Convert.ToInt16(ss[0]);
                y2 = Convert.ToInt16(ss[1]);
            }
            short outp;
            if ((x1 == x2) | (y1 == y2))
            {
                outp = 2;
            }
            else if (Math.Abs(x1 - x2) == Math.Abs(y1 - y2))
            {
                outp = 1;
            }
            else
                outp = 0;

            Console.WriteLine(outp);




        }
    }
}