#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int n;
int a[100010];
int b[100010];
set<int> f;
set<int> l;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; ++i) {
    f.insert(i);
  }
  for (int i = 0; i <= n; ++i) {
    if (f.find(a[i]) != f.end()) f.erase(f.find(a[i]));
    l.insert(a[i]);
  }
  for (int i = 1; i <= n; ++i) {
    if (a[i] == a[i - 1]) {
      b[i] = *f.begin();
      f.erase(f.begin());
    } else {
      b[i] = *l.begin();
      l.erase(l.begin());
    }
  }
  for (int i = 1; i <= n; ++i) {
    cout << b[i] << ' ';
  }
  return 0;
}
