#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int ans[maxn], raw[maxn];
int main() {
  int n;
  cin >> n;
  bool ok = 1;
  for (int i = 1; i <= n; i++) {
    ans[i] = i - 1;
    cin >> raw[i];
    if (raw[i] > i) ok = 0;
  }
  ans[n + 1] = n + 1;
  for (int i = n; i >= 1; i--) {
    if (raw[i] != i) swap(ans[raw[i] + 1], ans[i + 1]);
  }
  if (ok) {
    for (int i = 1; i <= n; i++) cout << ans[i] << " ";
  } else
    cout << -1;
  return 0;
}
