#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long powmod(long long base, long long exp) {
  long long res = 1LL;
  while (exp > 0) {
    if (exp & 1LL) res = (res * base);
    exp /= 2LL;
    base = (base * base);
  }
  return res;
}
signed main() {
  long long n;
  cin >> n;
  long long a[n];
  long long count = 0;
  long long step = 1, flag = 1;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < n; i++) {
    if (a[i] < count) {
      count;
      step++;
    } else if (a[i] == count) {
      count++;
      step++;
    } else {
      flag = 0;
      break;
    }
  }
  if (flag) {
    cout << -1 << endl;
  } else {
    cout << step << endl;
  }
  return 0;
}
