#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int n, A[maxn];
map<int, int> vis;
vector<int> ans;
void solve() {
  int x = 0;
  for (int i = (1); i <= (n); i++) {
    if (A[i] > i + 1) {
      cout << "-1\n";
      return;
    }
    if (i > 1 && A[i] != A[i - 1]) {
      ans.push_back(A[i - 1]);
      continue;
    }
    while (vis.find(x) != vis.end()) x++;
    ans.push_back(x);
    x++;
  }
  for (auto x : ans) printf("%d ", x);
}
void init() {
  vis.clear();
  ans.clear();
}
int main() {
  init();
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) {
    scanf("%d", &A[i]);
    vis[A[i]]++;
  }
  solve();
}
