"use strict"
function main(arg) {
    var data = arg.trim().split("\n")[1].split(" ").map(Number)
    var N = data.length
    var current = 1
    var sum = 0
    for (var i = 0; i < N; i++) {
        if (data[i] === current) {
            sum++
            current++
        }
    }
    if (sum === 0) {
        console.log(-1)
    } else {
        console.log(N - sum)
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));