import strscans

let
  (_, a, b, c, d) = stdin.readAll.scanTuple"$i $i $i $i"
  x = b.succ 31.pred a

echo:
  if x <= c: 1
  elif x <= d: 2
  else: 3