#include <bits/stdc++.h>
const double eps = (1e-9);
using namespace std;
int dcmp(long double a, long double b) {
  return fabsl(a - b) <= eps ? 0 : (a > b) ? 1 : -1;
}
int getBit(long long num, int idx) { return ((num >> idx) & 1ll) == 1; }
int setBit1(int num, int idx) { return num | (1 << idx); }
long long setBit0(long long num, int idx) { return num & ~(1ll << idx); }
long long flipBit(long long num, int idx) { return num ^ (1ll << idx); }
void M() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int countNumBit1(int mask) {
  int ret = 0;
  while (mask) {
    mask &= (mask - 1);
    ++ret;
  }
  return ret;
}
set<int> st;
int arr[100009];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  bool ok = 1;
  int res = -1;
  for (int i = 0; i < n && ok; i++) {
    if (((int)(st).size()) == 0) {
      if (arr[i] != 0) {
        res = i + 1;
        ok = 0;
      }
    } else {
      auto it = st.find(arr[i]);
      auto it2 = st.end();
      it2--;
      if (it == st.end() && arr[i] != (*it2) + 1) {
        res = i + 1;
        ok = 0;
      }
    }
    st.insert(arr[i]);
  }
  cout << res << endl;
}
