#include <bits/stdc++.h>
using namespace std;
long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
int n;
set<int> s;
void work() {
  n = read();
  for (register int i = (int)(0); i <= (int)(n - 1); i++) s.insert(i);
  for (register int i = (int)(1); i <= (int)(n); i++) {
    int x = read();
    if (x > (*s.begin())) {
      printf("%d\n", i);
      return;
    }
    if (s.find(x) != s.end()) s.erase(x);
  }
  puts("-1");
}
int main() { work(); }
