#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N];
bool st[N];
int main() {
  int n;
  cin >> n;
  priority_queue<int, vector<int>, greater<int> > heap;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    st[a[i]] = true;
  }
  for (int i = 0; i < 2 * n; i++) {
    if (!st[i]) heap.push(i);
  }
  for (int i = 1; i <= n; i++) {
    cout << heap.top() << ' ';
    heap.pop();
    if (a[i + 1] != a[i]) heap.push(a[i]);
  }
  return 0;
}
