#include <bits/stdc++.h>
using namespace std;
int read() {
  int ans = 0, f = 1;
  char c = getchar();
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + c - '0';
    c = getchar();
  }
  return ans * f;
}
const int N = 1e5 + 5;
int n, a[N], b[N], have, num, now = 1;
int main() {
  memset(b, -1, sizeof(b));
  n = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  for (int i = 1; i <= n; ++i) {
    if (a[i] > i) {
      printf("-1\n");
      return 0;
    }
    for (; num <= a[i] - 1; ++num) {
      if (b[i] == -1)
        b[i] = num;
      else {
        while (b[now] != -1) now++;
        b[now] = num;
      }
    }
    num = a[i];
  }
  for (int i = 1; i <= n; ++i)
    if (b[i] == -1)
      printf("%d ", 1000000);
    else
      printf("%d ", b[i]);
  return 0;
}
