function Main(input) {
  input = input.trim();
  input = input.split("\n")
  var arr = input[1].split(" ")
  var sum = 0;
  var count = 1;
  for(var i=0;i<input[0];i++){
  if(arr[i]==count){
  count++;
  }else{
  sum++;
  }
  }
  if(count ==1){
  console.log(-1)
  }else{
  console.log(sum)
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));