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;

typedef pair<long long int,long long int> pa;
typedef pair<int,int> pi;
#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define  MAX 500009
#define ll long long int
#define re return 0
#define co continue
long long int MOD=998244353;
long long int mod=1e9+7;
long long int INF=1e18;
ll dx[]={1,-1,0,0};
ll dy[]={0,0,1,-1};

/*
bool sortinrev(const pair<int,int> &a,  
               const pair<int,int> &b) 
{ 
       return (a.first > b.first); 
} 
*/

/*
Sieve
int n;
vector<char> is_prime(n+1, true);
is_prime[0] = is_prime[1] = false;
for (int i = 2; i * i <= n; i++) {
    if (is_prime[i]) {
        for (int j = i * i; j <= n; j += i)
            is_prime[j] = false;
    }
}
*/

const int M = 200 * 1000 + 11;

ll gcd(ll a,ll b)
{
	return __gcd(a,b);
}

long long binpow(long long a, long long b, long long m) {
    a %= m;
    long long 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);
	
	ll t,n,i;
	cin>>n;
	vector<ll> a(n),b(n,-1);
	map<ll,ll> r;
	
	for(i=0;i<n;i++)
	{
		cin>>a[i];
	}
	if(a[0]!=0)
	{
		b[0]=a[0]-1;
	}
	else
	{
		b[0]=1;
	}
    r[b[0]]=1;
    for(i=1;i<n;i++)
    {
    	if(a[i]!=a[i-1])
    	{
    		b[i]=a[i-1];
    		r[b[i]]=1;
		}
	}
	ll m=0;
	r[a[n-1]]=1;
	for(i=0;i<n;i++)
	{
		while(r[m])
		{
			m++;
		}
		
		if(b[i]==-1)
		{
			b[i]=m;
			r[b[i]]=1;
		}
	}
	
	for(i=0;i<n;i++)
	{
		cout<<b[i]<<" "; 
	}
}
	
	

