  let () =
  let (m1, d1) = Scanf.sscanf (input_line stdin) "%d %d" (fun a b -> (a, b)) in
  let (m2, d2) = Scanf.sscanf (input_line stdin) "%d %d" (fun a b -> (a, b)) in
  let ans = if m1 <> m2 then 1 else 0
  in
  print_int ans;
  print_newline ()
