#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  bool can = true;
  vector<long long> arr(t);
  set<long long> s;
  vector<long long> change;
  for (long long i = 1; i <= t; i++) {
    cin >> arr[i - 1];
    if (i > 1) {
      if (arr[i - 1] != arr[i - 2]) {
        change.push_back(i - 1);
      }
    }
    s.insert(arr[i - 1]);
    if ((arr[i - 1]) > i) {
      can = false;
      break;
    }
  }
  set<long long> se;
  for (long long i = 0; i < 1e6; i++) {
    se.insert(i);
  }
  for (long long i = 0; i < t; i++) {
    if (se.find(arr[i]) != se.end()) {
      se.erase(arr[i]);
    }
  }
  vector<long long> b(t, -1);
  if (can) {
    for (long long i = 0; i < change.size(); i++) {
      auto it = s.begin();
      b[change[i]] = *it;
      s.erase(s.begin());
    }
    for (long long i = 0; i < t; i++) {
      if (b[i] == -1) {
        auto it1 = se.begin();
        b[i] = *it1;
        se.erase(se.begin());
      }
    }
    for (long long i = 0; i < t; i++) {
      cout << b[i] << " ";
    }
  } else {
    cout << -1 << endl;
  }
}
