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

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