using System;

class MainClass {
  public static void Main (string[] args) {
    string red=Console.ReadLine();
    string [] brojevi=red.Split();
    int x1=Convert.ToInt32(brojevi[0]);
    int y1=Convert.ToInt32(brojevi[1]);
    string red1=Console.ReadLine();
    string [] brojevi1=red1.Split();
    int x2=Convert.ToInt32(brojevi1[0]);
    int y2=Convert.ToInt32(brojevi1[1]);
    if (x1!=x2 && y1!=y2) Console.Write("1");
    else Console.Write("2");
  }
}