using System;

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