using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
    static void Main(string[] args)
    {
        string[] in1 = Console.ReadLine().Split(' ');
        string[] in2 = Console.ReadLine().Split(' ');
        int x1 = int.Parse(in1[0]), y1 = int.Parse(in1[1]), x2 = int.Parse(in2[0]), y2 = int.Parse(in2[1]);
        if (x1 == x2 || y1 == y2)
        {
            Console.WriteLine(2);
            return;
        }
        int xa = Math.Abs(x1 - x2);
        int ya = Math.Abs(y1 - y2);
        if (xa >= ya && xa == ya)
        {
            Console.WriteLine(1);
            return;
        }
        else if (xa < ya && ya == xa)
        {
            Console.WriteLine(1);
            return;
        }
        else
        {
            Console.WriteLine(0);
        }
    }
}