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

namespace ConsoleApplication103
{
    class Program
    {
        static void Main(string[] args)
        {
            int x1;
            int y1;
            int x2;
            int y2;
            string[] s1= Console.ReadLine().Split();
            string[] s2= Console.ReadLine().Split();
            x1 = Convert.ToInt32(s1[0]);
            y1 = Convert.ToInt32(s1[1]);
            x2 = Convert.ToInt32(s2[0]);
            y2 = Convert.ToInt32(s2[1]);
            if (x1 == x2 || y1 == y2) Console.WriteLine(2);
            else if (Math.Abs(x1 - x2) == Math.Abs(y1 - y2)) Console.WriteLine(1);
            else Console.WriteLine(0);
            Console.ReadLine();

        }
    }
}