let x1,x2,x3,x4,x5 = Scanf.sscanf (read_line()) "%d %d %d %d %d" (fun q w e r t -> q,w,e,r,t)
let _ = (
  if x1 = 0 then "1" else
  if x2 = 0 then "2" else
  if x3 = 0 then "3" else
  if x4 = 0 then "4" else
"5") |> print_endline