using System;
class MainClass {
  static bool JeKvadrat(int x1, int x2, int y1, int y2)
  {
    if(Math.Abs(x1-x2)==Math.Abs(y1-y2))
    {
      return true;
    }
    return false;
  }
  public static void Main (string[] args) {
    string[] s = Console.ReadLine().Split(' ');
    int x1 = Convert.ToInt32(s[0]);
    int y1 = Convert.ToInt32(s[1]);
    s = Console.ReadLine().Split(' ');
    int x2 = Convert.ToInt32(s[0]);
    int y2 = Convert.ToInt32(s[1]);
    if(x1!=x2 && y1!=y2 && JeKvadrat(x1, x2, y1, y2))
    {
      Console.WriteLine(1);
    }
    else if(x1!=x2 && y1!=y2 && !JeKvadrat(x1, x2, y1, y2))
    {
      Console.WriteLine(0);
    }
    else if(x1==x2 && y1==y2)
    {
      Console.WriteLine(0);
    }
    else 
    {
      Console.WriteLine(2);
    }
  }
}