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 int mod1 = 1000000007;
long long int mod2 = 67280421310721;
long long int mod3 = 998244353;
long long int INF = 1e18;
long long int binpow1(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long int binpow2(long long int a, long long int b, long long int m) {
  a %= m;
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n;
  cin >> n;
  long long int a[n];
  long long int b[n];
  long long int p = 1;
  long long int c = 1;
  long long int f = 0;
  long long int k;
  long long int d;
  set<long long int> s1, s2;
  for (int i = (0); i < (n + 3); i++) {
    s1.insert(i);
  }
  for (int i = (0); i < (n); i++) {
    cin >> a[i];
    s1.erase(a[i]);
    s2.insert(a[i]);
  }
  if (a[0] == 0) {
    b[0] = 1;
    s1.erase(1);
  } else if (a[0] == 1) {
    b[0] = 0;
    s1.erase(0);
  }
  if (a[0] == 0 || a[0] == 1) {
    for (int i = (1); i < (n); i++) {
      if (a[i] == a[i - 1]) {
        b[i] = *(s1.begin());
        s1.erase(*(s1.begin()));
      } else if (*(s1.begin()) > a[i]) {
        b[i] = a[i - 1];
      } else {
        f = 1;
        break;
      }
    }
  } else {
    cout << -1 << '\n';
    return 0;
  }
  if (f == 0) {
    for (int i = (0); i < (n); i++) {
      cout << b[i] << " ";
    }
    cout << '\n';
  } else {
    cout << -1 << '\n';
  }
  return 0;
}
