#include <bits/stdc++.h>
using namespace std;
int a[100010];
int b[100010];
int main() {
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  queue<int> empty_location;
  int k = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] > k) {
      b[i] = k;
      for (int j = a[i] - 1; j > k; j--) {
        if (empty_location.empty()) {
          cout << "-1" << endl;
          return 0;
        }
        int location = empty_location.front();
        empty_location.pop();
        b[location] = j;
      }
      k = a[i];
    } else {
      empty_location.push(i);
    }
  }
  while (!empty_location.empty()) {
    int location = empty_location.front();
    empty_location.pop();
    b[location] = k + 1;
  }
  for (int i = 0; i < n; i++) {
    cout << b[i] << endl;
  }
  return 0;
}
