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 n, a[100000], b[100000];
int32_t main() {
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  if (a[0] != 0 && a[0] != 1) {
    cout << -1 << endl;
    exit(0);
  }
  b[0] = 1 - a[0];
  long long cur = b[0];
  long long cur_pos = 0;
  long long free = 0;
  long long mx = max(b[0], a[0]);
  vector<long long> fill_frees;
  for (long long i = 1; i < n; ++i) {
    if (a[i] == a[i - 1]) {
      ++free;
      b[i] = -1;
    } else {
      long long temp = cur;
      bool gay = false;
      if (a[i] == 1 && cur_pos == 0) continue;
      if (cur == 1 && cur_pos == 0)
        cur = 0, cur_pos = i, gay = 1;
      else if (cur == 0 && cur_pos != 0)
        ++ ++cur, cur_pos = i;
      else
        cur = a[i] - 1, cur_pos = i;
      for (long long j = cur + 1; j < a[i] && !gay; ++j) {
        fill_frees.push_back(j);
        long long filled = (long long)fill_frees.size();
        mx = max(mx, fill_frees[filled - 1]);
      }
      b[i] = cur;
    }
    mx = max({mx, b[i], a[i]});
  }
  long long need_to_fill = (long long)fill_frees.size();
  if (need_to_fill > free) {
    cout << -1 << endl;
    exit(0);
  }
  long long filled_so_far = 0;
  for (long long i = 0; i < n; ++i) {
    if (b[i] != -1) goto done;
    if (need_to_fill > 0)
      b[i] = fill_frees[filled_so_far++], --need_to_fill;
    else
      b[i] = ++mx;
  done:
    cout << b[i] << " ";
    ;
  }
  cout << endl;
}
