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>
//#include<boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;         // use cpp_int as data type
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;

const ll mod = 1e9 + 7;

#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define sidha(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define ulta(i,a,b) for(ll i=(ll)(a);i>=(ll)(b);--i)
#define sab(v) v.begin(),v.end()
#define test ll t;cin>>t;while(t--)
#define pb push_back
#define mp make_pair
#define LOG2(X) (63ll - __builtin_clzll(X))
#define endl '\n'
#define modinv(x) power(x, mod-2)

ll power(ll x, ll y) { 
    ll ans=1;
    x=x%mod;
    while(y>0) { 
        if (y&1) 
            ans=(ans*x)%mod; 
        y=y>>1;
        x=(x*x)%mod; 
    } 
    return ans; 
}
// vector<ll> arr[10005];
// ll visit[10005];
// void dfs(ll n){
//     visit[n]=1;
//     for(ll i=0;i<arr[n].size();++i){
//         if(visit[arr[n][i]]==0) dfs(arr[n][i]);
//     }
// }

int main()
{
    boost;
    ll n,a,flag,last;
        flag=0;
        cin>>n;
        last=1000000;
        ll arr[n],b[n],visit[n+1]={0};
        sidha(i,0,n){
            cin>>arr[i];
            if(arr[i]>i+1)  flag=1;
        }
        if(flag)    cout<<"-1\n";
        else{
            queue<ll> q;
            ulta(i,n-1,0){
                if(i==0){
                    if(arr[i]==0){
                        b[i]=last;
                    }
                    else{
                        b[i]=0;
                        visit[0]=0;
                    }
                }
                else if(arr[i]!=arr[i-1]){
                    b[i]=arr[i-1];
                    ulta(j,arr[i]-1,arr[i-1]+1){
                        if(visit[j]==0){
                            visit[j]=1;
                            q.push(j);
                        }
                    }
                }
                else{
                    if(q.empty()) b[i]=last--;
                    else{
                        a=q.front();
                        q.pop();
                        visit[a]=0;
                        b[i]=a;
                    }
                }
            }
        }
        sidha(i,0,n+1){
            if(visit[i]){
                flag=1;
                break;
            }
        }
        if(flag)    cout<<"-1\n";
        else{
            sidha(i,0,n)    cout<<b[i]<<" ";
        }
    return 0;
}