#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  bool can = true;
  vector<long long> v(n);
  set<long long> s;
  vector<long long> change;
  map<long long, long long> mp;
  for (long long i = 1; i <= n; i++) {
    cin >> v[i - 1];
    mp[v[i - 1]]++;
    if (i > 1) {
      if (v[i - 1] != v[i - 2]) {
        change.push_back(i - 1);
      }
    }
    s.insert(v[i - 1]);
    if ((v[i - 1]) > i) {
      can = false;
      break;
    }
  }
  if (can) {
    long long i = 0;
    long long count = 0;
    for (long long z = 0; z <= n + 1; z++) {
      if (mp[z] == 0) {
        cout << z << " ";
        count++;
        if (count == n) {
          break;
        }
        mp[v[i]]--;
        while (mp[v[i]] == 0) {
          cout << v[i] << " ";
          if (z < v[i]) {
            z++;
          }
          count++;
          if (count == n) {
            break;
          }
          i++;
          mp[v[i]]--;
        }
        if (count == n) {
          break;
        }
        i++;
      }
    }
  } else {
    cout << -1 << endl;
  }
}
