#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 20;
const int M = 1e6 + 20;
int a[N], ans[N];
int vis[M] = {0};
int main() {
  cout.tie(0);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    vis[a[i]]++;
  }
  int k = 0, cnt = 0;
  while (vis[k] >= 1) {
    k++;
  }
  vis[k] = 1;
  ans[cnt++] = k;
  for (int i = 1; i < n; i++) {
    if (a[i] > a[i - 1]) {
      ans[cnt++] = a[i - 1];
    } else if (a[i] == a[i - 1]) {
      while (vis[k] >= 1) {
        k++;
      }
      vis[k] = 1;
      ans[cnt++] = k;
    }
  }
  for (int i = 0; i < cnt; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
