#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    long long int n, i, j, k, m, x, y, flag = -1;
    cin >> n;
    k = 1000000;
    long long int a[n], b[n];
    x = 0;
    for (i = 0; i < n; i++) {
      cin >> a[i];
    }
    for (i = 0; i < n; i++) {
      if (flag > a[i] - 2)
        b[i] = k;
      else if (flag == a[i] - 2) {
        flag++;
        b[i] = flag;
      } else {
        b[i] = k;
        j = i;
        while (flag < a[i] - 1) {
          if (b[j] == k) {
            flag++;
            b[j] = flag;
          }
          j--;
        }
      }
    }
    for (i = 0; i < n; i++) cout << b[i] << " ";
    cout << endl;
  }
  return 0;
}
