using System;

namespace ConsoleApp9
{
    class Program
    {
        static void Main(string[] args)
        {
            Int32 x1 = Convert.ToInt32(Console.ReadLine());
            Int32  y1 = Convert.ToInt32(Console.ReadLine());
            Int32  x2 = Convert.ToInt32(Console.ReadLine());
            Int32  y2 = Convert.ToInt32(Console.ReadLine());
            if (x1 == x2)
            {
                Console.WriteLine("2");
            }else if (y2 == y1)
            {
                Console.WriteLine("2");
            }else 
            {
                if (Math.Abs(x1 - x2) == Math.Abs(y1 - y2))
                {
                    Console.WriteLine("1");
                }
                else
                {
                    Console.WriteLine("0");
                }
            }
        }
    }
}