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

namespace petlja1._2
{
    class Program
    {
        static void Main(string[] args)
        {
            UInt64 x1, x2, y1, y2;
            string[] nz = Console.ReadLine().Split();
            x1 = UInt64.Parse(nz[0]);
            y1 = UInt64.Parse(nz[1]);
            string[] nz1 = Console.ReadLine().Split();
            x2 = UInt64.Parse(nz1[0]);
            y2 = UInt64.Parse(nz1[1]);
            if (x1 != x2 && y1 != y2 && (x1 - x2 == y1 - y2 || x2-x1==y1-y2))            
                Console.WriteLine("1");
            else 
            {
                if (x1 == x2 || y1 == y2)
                    Console.WriteLine("2");
                else
                    Console.WriteLine("0");
            }
            Console.ReadLine();
        }
    }
}