using System;
using System.Linq;
using System.Security.Cryptography;

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