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

namespace Kvadrati
{
    class Program
    {
        static void Main(string[] args)
        {
            double x1, x2, y1, y2, n;
            var b = Console.ReadLine().Split();
            x1 = double.Parse(b[0]);
            y1 = double.Parse(b[1]);
            b = Console.ReadLine().Split();
            x2 = double.Parse(b[0]);
            y2 = double.Parse(b[1]);
            if (x1 == x2 || y1 == y2)
            {
                n = 2;
            }
            else if((x2 > x1 && y2 > y1 && x2 - x1 == y2 - y1) || (x1 > x2 && y1 > y2 && x1 - x2 == y1 - y2)||(x2 > x1 && y1 > y2 && x2 - x1 == y1 - y2) || (x1 > x2 && y2 > y1 && x1 - x2 == y2 - y1))
            {
                n = 1;
            }
            else
            {
                n = 0;
            }
            Console.WriteLine(n);
        }
    }
}