#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005];
bool ex[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    memset(b, -1, sizeof(b));
    for (int i = 1; i <= n; i++) {
      if (a[i] != a[i - 1]) {
        b[i] = a[i - 1];
        ex[b[i]] = 1;
      }
    }
    ex[a[n]] = 1;
    int m = 0;
    for (int i = 1; i <= n; i++) {
      while (ex[m]) m++;
      if (b[i] == -1) {
        b[i] = m;
        ex[m] = 1;
      }
      cout << b[i] << " ";
    }
  }
  return 0;
}
