#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int *a = new int[n];
  int *b = new int[n];
  bool *visited = new bool[1000001];
  bool flag = true;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = -1;
    if (a[i] > i + 1) {
      flag = false;
    }
    if (i > 0) {
      if (a[i] != a[i - 1]) b[i] = a[i - 1];
    }
    visited[a[i]] = true;
  }
  if (!flag) {
    cout << -1 << endl;
    delete[] a;
    delete[] visited;
    return 0;
  }
  int j = 0;
  for (int i = 0; i < n; i++) {
    if (b[i] == -1) {
      while (visited[j]) {
        j++;
      }
      b[i] = j;
      visited[j] = true;
    }
  }
  for (int i = 0; i < n; i++) cout << b[i] << " ";
  cout << endl;
  delete[] a;
  delete[] b;
  delete[] visited;
}
