#include <bits/stdc++.h>
using namespace std;
long long n, a[100005], b[100005], poss[100005];
void solve() {
  cin >> n;
  cin >> a[0];
  memset(b, -1, sizeof(b));
  bool possible = true;
  if (a[0] == 1) {
    b[0] = 0;
  }
  long long j = 0;
  for (long long i = 1; i < n; i++) {
    cin >> a[i];
    if (possible) {
      if (a[i] != a[i - 1]) {
        b[i] = a[i - 1];
        for (long long k = a[i - 1] + 1; k < a[i]; k++) {
          while (b[j] != -1) j++;
          if (j >= i) {
            possible = false;
            break;
          }
          b[j] = k;
        }
      }
    }
  }
  for (long long i = j; i < n; i++)
    if (b[i] == -1) b[i] = 1000000;
  if (possible) {
    cout << "" << b[0];
    for (long long noname = 0 + 1; noname < n; noname++)
      cout << " " << b[noname];
    cout << "\n";
    return;
  }
  cout << -1 << endl;
}
void aux() {}
int main() {
  aux();
  long long _ = 1;
  while (_--) {
    solve();
  }
  return 0;
}
