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

namespace prviZadatak
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            long x1 = long.Parse(s[0]);
            long y1 = long.Parse(s[1]);

            s = Console.ReadLine().Split();
            long x2 = long.Parse(s[0]);
            long y2 = long.Parse(s[1]);

            if (x1 == x2)
            {
                Console.WriteLine(2);
            }
            else if (y1 == y2)
            {
                Console.WriteLine(2);
            }
            else
            {
                if (Math.Abs(x1 - x2) == Math.Abs(y1 - y2))
                {
                    Console.WriteLine(1);
                }
                else
                {
                    Console.WriteLine(0);
                }
            }
        }
    }
}