#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, mod = 1e9 + 7;
int test = 1;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  ;
  int n;
  cin >> n;
  int a[n + 1];
  int mex = 0, f = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] > (i + 1)) f = 0;
  }
  int b[n + 1];
  if (f == 0) {
    cout << -1 << endl;
    exit(0);
  }
  map<int, int> m;
  int d = n;
  for (int i = n - 1; i >= 0; i--) {
    m[a[i]]++;
    if (a[i - 1] != a[i] && i != 0) {
      b[i] = a[i - 1];
      m[a[i - 1]]++;
    } else {
      while (m[d] > 0) d--;
      b[i] = d;
      d--;
    }
  }
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << endl;
}
