#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i <= 0; i++) {
    if (arr[i] != i) {
      cout << i + 1;
      return 0;
    }
  }
  long long int min = 0;
  long long int max = 0;
  long long int t = -1;
  for (int i = 1; i < n; i++) {
    if (arr[i] > max + 1 || arr[i] < 0) {
      t = i + 1;
      break;
    }
    if (arr[i] == max + 1) max = arr[i];
  }
  cout << t << endl;
}
