breaking n state [] = if state == 1 then -1 else n
breaking n state lst = 
  let h = head lst
  in if h == state
    then breaking n (state+1) (tail lst)
    else breaking (n+1) state (tail lst)

main = do
  _ <- getLine
  as <- (map read) . words <$> getLine
  print $ breaking 0 1 as