using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] a = Console.ReadLine().Split();
            int x1 = int.Parse(a[0]);
            int y1 = int.Parse(a[1]);
            String[] a1 = Console.ReadLine().Split();
            int x2 = int.Parse(a1[0]);
            int y2 = int.Parse(a1[1]);
            int br;
            int maxx = Math.Max(x1, x2);
            int minx = Math.Min(x1, x2);
            int maxy = Math.Max(y1, y2);
            int miny = Math.Min(y1, y2);
            int strx = maxx - minx;
            int stry = maxy - miny;
            if (x1 == x2 || y1 == y2)
            {
                br = 2;
            }
            else if (strx == stry)
            {
                br = 1;
            }
            else
            {
                br = 0;
            }
            Console.WriteLine(br);
        }
    }
}