using System;
class MainClass {
  public static void Main (string[] args) {
    string unos = Console.ReadLine();
    string[] temp = unos.Split();
    int x1 = Convert.ToInt32(temp[0]);
    int y1 = Convert.ToInt32(temp[1]);
    unos = Console.ReadLine();
    temp = unos.Split();
    int x2 = Convert.ToInt32(temp[0]);
    int y2 = Convert.ToInt32(temp[1]);
    if (x1 == x2 && y1 == y2) Console.WriteLine(0);
    else if (x1 == x2 || y1 == y2) Console.WriteLine(2);
    else if (Math.Max(x1, x2) - Math.Min(x1, x2) == Math.Max(y1, y2) - Math.Min(y1, y2)) Console.WriteLine(1);
    else Console.WriteLine(0);
  }
}