import java.util.Scanner

object Main {
  def main(args: Array[String]) {
    val result = solve(new Scanner(System.in))
    if (result.length > 0) println(result)
  }

  def solve(in: String): String = solve(new Scanner(in))

  def solve(sc: Scanner): String = {
    val N = sc.nextInt
    val A = Array.fill(N)(sc.nextInt)

    var n = 1
    var r = 0
    for (ai <- A) {
      if (ai != n) {
        r += 1
      } else {
        n += 1
      }
    }
    if (r == N) "-1" else r.toString
  }
}
