Given an array a of length n, find another array, b, of length n such that:

  * for each i (1 ≤ i ≤ n) MEX(\\{b_1, b_2, …, b_i\})=a_i. 



The MEX of a set of integers is the smallest non-negative integer that doesn't belong to this set.

If such array doesn't exist, determine this.

Input

The first line contains an integer n (1 ≤ n ≤ 10^5) — the length of the array a.

The second line contains n integers a_1, a_2, …, a_n (0 ≤ a_i ≤ i) — the elements of the array a. It's guaranteed that a_i ≤ a_{i+1} for 1≤ i < n.

Output

If there's no such array, print a single line containing -1.

Otherwise, print a single line containing n integers b_1, b_2, …, b_n (0 ≤ b_i ≤ 10^6)

If there are multiple answers, print any.

Examples

Input


3
1 2 3


Output


0 1 2 

Input


4
0 0 0 2


Output


1 3 4 0 

Input


3
1 1 3


Output


0 2 1 

Note

In the second test case, other answers like [1,1,1,0], for example, are valid.
#include <bits/stdc++.h>
using namespace std;
long long factorial(long long n) {
  return (n == 1 || n == 0) ? 1 : n * factorial(n - 1);
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
bool sortByVal(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  if (a.first == b.first)
    return a.second < b.second;
  else
    return a.first > b.first;
}
long long Powb(long long b, long long n) {
  if (n == 0) return 1LL;
  if (n == 1) return b;
  long long temp = Powb(b, n / 2);
  if (n % 2 == 0) {
    return (temp * temp) % 1000000007LL;
  } else {
    return (b * ((temp * temp) % 1000000007LL)) % 1000000007LL;
  }
}
long long root(vector<long long> &a, long long i) {
  while (a[i] != i) {
    a[i] = a[a[i]];
    i = a[i];
  }
  return i;
}
void wunion(vector<long long> &a, vector<long long> &size, long long i,
            long long j) {
  long long root_i = root(a, i);
  long long root_j = root(a, j);
  if (root_i == root_j) return;
  if (size[root_i] < size[root_j]) {
    a[root_i] = a[root_j];
    size[root_j] += size[root_i];
    size[root_i] = 0;
  } else {
    a[root_j] = a[root_i];
    size[root_i] += size[root_j];
    size[root_j] = 0;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int t = 1;
  while (t--) {
    long long i, j, m, n, k, sum = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0,
                             maxi = 0;
    cin >> n;
    vector<long long> a(n), b(n);
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    };
    b = a;
    sort(b.begin(), b.end());
    if (b != a)
      cout << -1 << "\n";
    else {
      b.clear();
      for (i = 0; i < n; i++) {
        b[i] = i + 1;
        if (a[i] > b[i]) {
          f = 1000000007LL;
          break;
        }
      }
      if (f == 1000000007LL)
        cout << -1 << "\n";
      else {
        for (i = 0; i < n; i++) b[i] = i;
        vector<bool> vis(1000005, false);
        for (i = 0; i < n; i++) {
          vis[a[i]] = true;
        }
        priority_queue<long long, vector<long long>, greater<long long> > q;
        d = *max_element(a.begin(), a.end());
        for (i = 0; i < 100005; i++) {
          if (vis[i] == false) q.push(i);
        }
        for (i = 0; i < n; i++) {
          set<long long> p;
          while (true) {
            c = q.top();
            q.pop();
            if (c < a[i] || c > a[i]) {
              cout << c << " ";
              q.push(a[i]);
              break;
            } else {
              p.insert(c);
            }
          }
        }
      }
    }
  }
}
