[<AutoOpen>]
module Program

open System

let read f = stdin.ReadLine() |> f
let reads f = stdin.ReadLine().Split() |> Array.map f

[<EntryPoint>]
let main _ =
    let N = read int
    let AS = reads int

    let mutable cnt = 0
    for i in AS do
        if i = cnt + 1 then cnt <- cnt + 1

    match cnt with
    | 0 -> printfn "-1"
    | _ -> printfn "%i" (N - cnt)

    0