using System;

namespace Zadatak1
{
    class Program
    {
        static void Main(string[] args)
        {
            var koordinata1 = Console.ReadLine();
            var koordinata1Parsed = ParseInput(koordinata1);
            var x1 = koordinata1Parsed.Item1;
            var y1 = koordinata1Parsed.Item2;

            var koordinata2 = Console.ReadLine();
            var koordinata2Parsed = ParseInput(koordinata2);
            var x2 = koordinata2Parsed.Item1;
            var y2 = koordinata2Parsed.Item2;


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

        static Tuple<int, int> ParseInput(string input)
        {
            var splitInput = input.Split(' ');

            if (splitInput.Length != 2)
            {
                throw new ArgumentException("Morate uneti tacno 2 broja");
            }

            var x1 = int.Parse(splitInput[0]);
            var x2 = int.Parse(splitInput[1]);

            return new Tuple<int, int>(x1, x2);
        }
    }
}