#include <bits/stdc++.h>
using namespace std;
int n, a[109000], book[109000];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    book[a[i]] = 1;
  }
  int cnt = 0;
  for (int i = 1; i <= n; ++i) {
    if (i != 1 && a[i] != a[i - 1])
      printf("%d ", a[i - 1]);
    else {
      while (book[cnt] == 1) cnt++;
      printf("%d ", cnt++);
    }
  }
  printf("\n");
  return 0;
}
