#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int ara[n];
  int v1, v2 = n - 1;
  for (v1 = 0; v1 < n - 1; v1++) {
    scanf("%d ", &ara[v1]);
  }
  scanf("%d", &ara[n - 1]);
  int ans, mp;
  ans = 1;
  mp = -1;
  for (v1 = 0; v1 < n; v1++) {
    if (ara[v1] > mp + 1) {
      break;
    } else {
      ans++;
      if (ara[v1] == mp + 1) {
        mp++;
      }
    }
  }
  if (ans < n + 1) {
    printf("%d\n", ans);
  } else {
    printf("-1\n");
  }
  return 0;
}
