open Base
open Stdio

let () =
  let arr =
    Caml.Scanf.scanf "%d %d %d %d %d" (fun a b c d e -> [|a; b; c; d; e|])
  in
  let count = ref 0 in
  let ans = ref (-1) in
  while (phys_equal !ans (-1)) do
    if phys_equal arr.(!count) 0
    then ans := !count + 1
    else count := !count + 1
  done;
  !ans |> Int.to_string |> print_endline;
