#include <bits/stdc++.h>
using namespace std;
const int N = 100010, M = 1010;
int n;
int a[N], b[N];
bool st[N];
int main() {
  memset(b, -1, sizeof b);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    if (a[i] != a[i - 1]) {
      b[i] = a[i - 1];
      st[a[i - 1]] = true;
    }
  }
  st[a[n]] = true;
  int j = 0;
  for (int i = 1; i <= n; i++) {
    while (st[j]) j++;
    if (b[i] == -1) {
      b[i] = j;
      st[j] = true;
    }
    printf("%d ", b[i]);
  }
  puts("");
  return 0;
}
