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

namespace Takmicenje2Zadatak1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int x1 = int.Parse(s[0]);
            int y1 = int.Parse(s[1]);
            s = Console.ReadLine().Split();
            int x2 = int.Parse(s[0]);
            int y2 = int.Parse(s[1]);
            int resenje = 0;
            if (x1 == x2 || y1 == y2)
            {
                resenje = 2;
            }
            else if (x1 - x2 == y1 - y2)
            {
                resenje = 1;
            }
            Console.WriteLine(resenje);
        }
    }
}