using System;

namespace Kvadrat
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] m = Console.ReadLine().Split();
            int x1 = int.Parse(m[0]);
            int y1 = int.Parse(m[1]);
            string[] n = Console.ReadLine().Split();
            int x2 = int.Parse(n[0]);
            int y2 = int.Parse(n[1]);
            if (y1 != y2 && x1 != x2)
            {
                if (Math.Abs(Math.Abs(x1) - Math.Abs(x2)) == Math.Abs(Math.Abs(y1) - Math.Abs(y2)))
                {
                    Console.WriteLine(1);
                }
                else Console.WriteLine(0);
            }
            else if (y1 == y2 || x1 == x2) Console.WriteLine(2);
            else
                Console.WriteLine(0);
                
        }
    }
}