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

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s;
            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]);
            if (Math.Abs(x2 - x1) == Math.Abs(y2 - y1))
            {
                Console.WriteLine("1");
            }
            else if (x1 == x2)
            {
                Console.WriteLine("2");
            }
            else if (y1 == y2)
            {
                Console.WriteLine("2");
            }
            else
            {
                Console.WriteLine("0");
            }
        }
    }
}