using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace kvadrati
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] p1 = Console.ReadLine().Split(' ');
            long x1 = long.Parse(p1[0]);
            long y1 = long.Parse(p1[1]);

            string[] p2 = Console.ReadLine().Split(' ');
            long x2 = long.Parse(p2[0]);
            long y2 = long.Parse(p2[1]);

            if (Math.Abs(x1 - x2) == Math.Abs(y1 - y2)) Console.WriteLine("1");
            else if (x1 == x2 || y1 == y2)
            {
                if (!(x1 == x2 && y1 == y2))
                {
                    Console.WriteLine("2");
                }
            }
            else Console.WriteLine("0");
        }
    }
}