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

namespace Takmicenje2_zad1
{
    class Program
    {
        static void Main(string[] args)
        {
            long x1, y1, x2, y2;
            string[] unos1 = Console.ReadLine().Split();
            x1 = Convert.ToInt64(unos1[0]);
            y1 = Convert.ToInt64(unos1[1]);
            string[] unos2 = Console.ReadLine().Split();
            x2 = Convert.ToInt64(unos2[0]);
            y2 = Convert.ToInt64(unos2[1]);
            if(Math.Abs(x1)==Math.Abs(x2) || Math.Abs(y1) == Math.Abs(y2))
            {
                Console.WriteLine("2");
            }
            else
            {
                if (Math.Abs(x1 - x2) == Math.Abs(y1 - y2))
                    Console.WriteLine("1");
                else
                    Console.WriteLine("0");
            }
            Console.ReadLine();
        }
    }
}