using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] x = Console.ReadLine().Split();
            int x1 = int.Parse(x[0]);
            int y1 = int.Parse(x[1]);
            x = Console.ReadLine().Split();
            int x2 = int.Parse(x[0]);
            int y2 = int.Parse(x[1]);
            if(x2-x1==y2-y1)
            {
                Console.WriteLine("1");
            }
            else if(x2==x1 || y2==y1)
            {
                Console.WriteLine("2");
            }
            else 
            {
                Console.WriteLine("0");
            }
        }
    }
}