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

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