#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n, -1);
  vector<bool> used(1e6 + 1, 0);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (i && a[i] != a[i - 1]) {
      b[i] = a[i - 1];
    }
    used[a[i]] = 1;
  }
  int cur = 0;
  for (int i = 0; i < n; ++i) {
    if (b[i] != -1) goto done;
    while (used[cur]) ++cur;
    b[i] = cur, used[cur] = 1;
  done:
    cout << b[i] << " ";
    ;
  }
  cout << endl;
}
