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>
#pragma GCC optimize(3, "Ofast", "inline")
using namespace std;
namespace FastIO {
char print_f[105];
void read() {}
void print() { putchar('\n'); }
template <typename T, typename... T2>
inline void read(T &x, T2 &...oth) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
  read(oth...);
}
template <typename T, typename... T2>
inline void print(T x, T2... oth) {
  long long p3 = -1;
  if (x < 0) putchar('-'), x = -x;
  do {
    print_f[++p3] = x % 10 + 48;
  } while (x /= 10);
  while (p3 >= 0) putchar(print_f[p3--]);
  putchar(' ');
  print(oth...);
}
}  // namespace FastIO
using FastIO::print;
using FastIO::read;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const int maxn = 1e6 + 5;
int a[maxn], b[maxn], vis[maxn];
map<int, int> mp;
int main() {
  int n;
  read(n);
  for (int i = 0; i <= 2 * n; i++) mp[i] = 0;
  int ok = 0;
  for (int i = 1; i <= n; i++) {
    read(a[i]);
    vis[a[i]]++;
    if (a[i] > i) ok = 1;
  }
  if (ok) {
    cout << "-1\n";
    return 0;
  }
  int pre = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = pre;; j++) {
      if (!vis[j]) {
        b[i] = j;
        vis[j]++;
        break;
      }
    }
    vis[a[i]]--;
    if (vis[a[i]] == 0)
      pre = a[i];
    else
      pre = b[i] + 1;
  }
  for (int i = 1; i <= n; i++) cout << b[i] << " ";
  return 0;
}
