#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n, -1);
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<bool> visited(100005, false);
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i - 1]) {
      b[i] = a[i - 1];
      visited[a[i - 1]] = true;
    }
  }
  visited[a[n - 1]] = true;
  int cur = 0;
  for (int i = 0; i < n; i++) {
    while (visited[cur]) cur++;
    if (b[i] == -1) {
      b[i] = cur;
      visited[cur] = true;
    }
    cout << b[i] << " ";
  }
}
