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<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define mkp(a,b)        make_pair(a,b)
#define PI              3.14159265359
#define ll              long long
#define ul              unsigned long long
#define ld              long double
#define mset(arr,val)   memset(arr,val,sizeof arr)
#define MAXN            (long long)2e5+5
#define eb              emplace_back
#define mod             (long long)(1e9+7)
#define FILE_READ       freopen("input.txt","r",stdin)
#define FILE_WRITE      freopen("output.txt","w",stdout)
#define	IOS             ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define ALL(x)          x.begin(),x.end()
#define ordered_set     tree<let, null_type,less_equal<let>, rb_tree_tag,tree_order_statistics_node_update> 
#ifndef ONLINE_JUDGE    
                        #define TRACE
#endif
#ifdef TRACE            
                        #define debug(...) __debug_printer(#__VA_ARGS__,__VA_ARGS__)
                        template<typename Arg1>
                        void __debug_printer(const char* name, Arg1&& arg1) {
                        	std::cerr<<name << " = " << arg1<<"\n";	
                        }
                        template<typename Arg1, typename ...Args>
                        void __debug_printer(const char* names, Arg1&& arg1, Args&&... args) {
                        	const char* comma = strchr(names, ',');
                        	std::cerr.write(names, comma - names) << " = " << arg1<<" |";
                        	__debug_printer(comma+1, args...);
                        }
#else
                        #define debug(...)
#endif
using namespace std;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
	#ifndef ONLINE_JUDGE
		FILE_READ;
		FILE_WRITE;
	#endif
	IOS;

	int t = 1;
	// cin>>t;
	while(t--) {
		int n;
		int a[200001];
		cin>>n;
		bool p = true;
		for(int i = 0; i < n; ++i) {
			cin>>a[i];
			if(a[i]>=i+2) {
				p = false;
				break;
			}
		}
		if(!p) {
			cout<<-1<<endl;
			continue;
		}
		for(int i = 1; i < n; ++i) {
			if(a[i] < a[i - 1]) {
				p = false;
				break;
			}
		}
		if(!p) {
			cout<<-1<<endl;
			continue;
		}
		unordered_map<int,int> mp;
		set<int> pending;
		int ans[n];
		int curr = 0;
		for(int i = 0; i < n; ++i) {
			int mex = a[i];
			if(mp[mex]) {
				ans[mp[mex] - 1] = curr;
				mp[curr] = mp[mex];
				mp[mex] = 0;
				++curr;
				pending.insert(mex);
				if(pending.empty() || *pending.begin() == mex) {
					ans[i]=curr;
					mp[curr] = i + 1;
					++curr;
					continue;
				}
				else if(*pending.begin() < mex) {
					int beg = *pending.begin();
					pending.erase(beg);
					ans[i] = beg;
					mp[beg] = i + 1;
				}
			}
			else if(mex == curr) {
				pending.insert(curr);
				++curr;
				ans[i] = curr;
				mp[curr] = i + 1;
				++curr;
			}
			else {
				ans[i] = curr;
				mp[curr] = i + 1;
				++curr;
			}
		}
		for(int i = 0; i < n; ++i) {
			// cout<<"*";
			cout<<ans[i]<<" ";
		}

	}

	return 0;
}