using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] line = Console.ReadLine().Split();
            int x = int.Parse(line[0]);
            int y = int.Parse(line[1]);
            line = Console.ReadLine().Split();
            int x1 = int.Parse(line[0]);
            int y1 = int.Parse(line[1]);
            Console.WriteLine(Koliko_kvadrata(x,y,x1,y1));
        }
        static int Koliko_kvadrata(int x, int y, int x1, int y1)
        {
            if (Math.Abs(x - x1) == Math.Abs(y - y1))
                return 1;
            else if ((x!=y && x1!=y1) || (x!=y1 && y!=x1))
                return 0;
            else
                return 2;
        }
    }
}