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

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

            string[] tacka2 = Console.ReadLine().Split();
            int x2 = int.Parse(tacka2[0]);
            int y2 = int.Parse(tacka2[1]);

            if (x1 != x2 && y1 != y2)
            {
                double d = Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2));
                double a = Math.Round(d * Math.Sqrt(2) / 2);
                if (x1 - a == x2 || x1 + a == x2 || y1 - a == y2 || y1 + a == y2)
                    Console.WriteLine(1);
                else
                    Console.WriteLine(0);
            }
            else
                Console.WriteLine(2);
        }
    }
}