function main(input){
    input = input.split('\n');
    num = parseInt(input[0]);
    brick = input[1].split(' ');
    counter = 1;

    for(i=0;i<num;i++){
        if( brick[i] == String(counter)){
            counter++;
        }
    }

    if(counter==1){
        console.log(-1);
    }
    else{
        console.log(num-counter+1);
    }    
}

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