(*
ocamlfind ocamlopt -package batteries -linkpkg main.ml -o a.out
*)
open Batteries

let x1, x2, x3, x4, x5 = Scanf.sscanf (read_line ()) "%d %d %d %d %d" ( fun x1 x2 x3 x4 x5 -> x1, x2, x3, x4, x5)

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
        ) |> Printf.printf "%d\n"
