#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j = 0;
  cin >> n;
  int a[n];
  unordered_set<int> s, v;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    s.insert(a[i]);
  }
  vector<int> p;
  while (s.find(j) != s.end()) j++;
  v.insert(j);
  p.push_back(j++);
  for (i = 0; i < n; i++) {
    if (a[i] != 0 && v.find(a[i] - 1) == v.end()) break;
    if (i + 1 < n && a[i + 1] != a[i]) {
      v.insert(a[i]);
      p.push_back(a[i]);
    } else {
      while (s.find(j) != s.end()) j++;
      v.insert(j);
      p.push_back(j);
      j++;
    }
  }
  if (i < n)
    cout << -1 << endl;
  else {
    for (i = 0; i < n; i++) cout << p[i] << " ";
  }
}
