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