#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n, 1), cant(1e5 + 7, 0);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    cant[a[i]] += 1;
  }
  priority_queue<int, vector<int>, greater<int>> q;
  for (int i = 0; i < 1e5 + 7; ++i) {
    if (!cant[i]) q.push(i);
  }
  for (int i = 0, mx = 0; i < n; ++i) {
    b[i] = q.top();
    q.pop();
    cant[a[i]] -= 1;
    if (!cant[a[i]]) q.push(a[i]);
  }
  for (int& i : b) {
    cout << i << ' ';
  }
  return 0;
}
