#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  bool found = true;
  for (int i = 0; i < n; i++) {
    if (arr[i] > i + 1) {
      found = false;
      break;
    }
  }
  map<int, int> m;
  if (!found)
    cout << "-1" << endl;
  else {
    for (int i = 0; i < n; i++) m[arr[i]] = i;
    int b[n];
    for (int i = 0; i < n; i++) {
      b[i] = -1;
    }
    map<int, int>::iterator it;
    for (it = m.begin(); it != m.end(); it++) {
      if (it->second < n - 1) {
        b[it->second + 1] = it->first;
      }
    }
    int j = 0;
    for (int i = 0; i < n; i++) {
      if (b[i] != -1) continue;
      while (m.count(j) > 0) j++;
      b[i] = j;
      j++;
    }
    for (int i = 0; i < n; i++) cout << b[i] << " ";
    cout << endl;
  }
}
