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.

import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;


public class Educational89 {

	
	static int X[] = { -1, 0, 0, 1 };
	static int Y[] = { 0, -1, 1, 0 };

	static class Reader {
		final private int BUFFER_SIZE = 1 << 16;
		private DataInputStream din;
		private byte[] buffer;
		private int bufferPointer, bytesRead;

		public Reader() {
			din = new DataInputStream(System.in);
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public Reader(String file_name) throws IOException {
			din = new DataInputStream(new FileInputStream(file_name));
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = bytesRead = 0;
		}

		public String readLine() throws IOException {
			byte[] buf = new byte[64]; // line length
			int cnt = 0, c;
			while ((c = read()) != -1) {
				if (c == '\n')
					break;
				buf[cnt++] = (byte) c;
			}
			return new String(buf, 0, cnt);
		}

		public int nextInt() throws IOException {
			int ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (neg)
				return -ret;
			return ret;
		}

		public long nextLong() throws IOException {
			long ret = 0;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();
			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');
			if (neg)
				return -ret;
			return ret;
		}

		public double nextDouble() throws IOException {
			double ret = 0, div = 1;
			byte c = read();
			while (c <= ' ')
				c = read();
			boolean neg = (c == '-');
			if (neg)
				c = read();

			do {
				ret = ret * 10 + c - '0';
			} while ((c = read()) >= '0' && c <= '9');

			if (c == '.') {
				while ((c = read()) >= '0' && c <= '9') {
					ret += (c - '0') / (div *= 10);
				}
			}

			if (neg)
				return -ret;
			return ret;
		}

		private void fillBuffer() throws IOException {
			bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
			if (bytesRead == -1)
				buffer[0] = -1;
		}

		private byte read() throws IOException {
			if (bufferPointer == bytesRead)
				fillBuffer();
			return buffer[bufferPointer++];
		}

		public void close() throws IOException {
			if (din == null)
				return;
			din.close();
		}
	}

	

	public static long[] initArray(int n, Reader scan) throws IOException {

		long arr[] = new long[n];
		for (int i = 0; i < n; i++) {
			arr[i] = scan.nextLong();
		}

		return arr;
	}

	public static long sum(long arr[]) {

		long sum = 0;
		for (long i : arr) {
			sum += (long) i;
		}

		return sum;
	}

	public static long max(long arr[]) {

		long max = Long.MIN_VALUE;

		for (long i : arr) {
			max = Math.max(i, max);
		}

		return max;
	}

	public static long min(long arr[]) {
		long min = Long.MAX_VALUE;

		for (long i : arr) {
			min = Math.min(i, min);
		}

		return min;
	}

	public static List<Integer>[] initAdjacency(int n, int e, Reader scan, boolean type) throws IOException {

		List<Integer> adj[] = new ArrayList[n + 1];

		for (int i = 0; i < e; i++) {
			int u = scan.nextInt();
			int v = scan.nextInt();

			if (adj[u] == null)
				adj[u] = new ArrayList<>();
			if (type && adj[v] == null)
				adj[v] = new ArrayList<>();

			adj[u].add(v);

			if (type)
				adj[v].add(u);

		}

		return adj;
	}
	public static void main(String[] args) throws IOException {
		
		Reader scan=new Reader();
//		Scanner scan=new Scanner(System.in);
		
		int t=1;
		while(t-->0) {
			int n=scan.nextInt();
			long[] arr=initArray(n, scan);
			C(n, arr);
		}
		
	}
	
	public static long A(int n, long arr[], long x) {
		
		int ans= -1;
		
		int minIndex=Integer.MAX_VALUE;
		long last=0;
		for(int i=0;i<n;i++) {
			arr[i]+=last;
			arr[i]%=x;
			last=arr[i];
			
			if(arr[i]!=0) {
				ans=Math.max(ans, i+1);
				minIndex=Math.min(minIndex, i);
			}else {
				
				if(minIndex!=Integer.MAX_VALUE) {
					ans=Math.max(ans,  i-minIndex);
				}
			}
		}
		
		return ans;
		
		
		
	}
	
	public static void B(int n, long arr[]) {
		
		boolean down=false;
		boolean up=false;
		
		StringBuilder ans=new StringBuilder("");
		int count=1;
		if(arr[1]>arr[0]) {
			up=true;
		}else {
			down=true;
		}
		
		ans.append(arr[0]+" ");
		for(int i=1;i<n;i++) {
			
			if(up) {
				
				if(arr[i]<arr[i-1]) {
					count++;
					ans.append(arr[i-1]+" ");
					up=false;
					down=true;
				}
			}else {
				
				if(arr[i]>arr[i-1]) {
					count++;
					ans.append(arr[i-1]+" ");
					down=false;
					up=true;
				}
			}
			
		}
		
		count++;
		ans.append(arr[n-1]);
		System.out.println(count);
		System.out.println(ans.toString());
		
	}
	
	public static long B(int n, int x, int m, Reader scan) throws IOException {
		
		int curLeft= x;
		int curRight=x;
		
		for(int i=0;i<m;i++) {
			int l=scan.nextInt();
			int r=scan.nextInt();
			
			if(l>curRight||r<curLeft) {
				continue;
			}
			
			curLeft= Math.min(curLeft,  l);
			curRight=Math.max(curRight, r);
		}
		
		return curRight-curLeft+1;
		
	}
	
	public static int C(int n, int m, int arr[][]) {
		
		
		int ans=0;
		
		for(int val=0;val< (Math.max(n, m)+1)/2;val++) {
			
			int count[]=new int[2];
			
			for(int i=0;i<=val;i++) {
				int j= val-i;
				
				if(i>=0&&i<n&&j>=0&&j<m) {
					count[arr[i][j]]++;
				}
				
			}
			
			for(int i=0;i<= val;i++) {
				int j= m-1-val+i;
				
				if(i>=0&&i<n&&j>=0&&j<m) {
					count[arr[n-1-i][j]]++;
				}
			}
			
//			if(Math.max(n, m)%2==0&&val==(Math.max(n, m)/2)) {
//				count[0]/=2;
//				count[1]/=2;
//			}
			
			//System.out.println("For val="+val+"count="+Arrays.toString(count));
			ans+= Math.min(count[0], count[1]);
			
		}
		
		return  ans;
		
	}
	
	public static void C(int n, long arr[]) {
		
		Queue<Integer> empty=new LinkedList<>();
		
		long ans[]=new long[n];
		
		long last=0;
		
		int curSize=0;
		
		for(int i=0;i<n;i++) {
			
			if(arr[i]==last) {
				empty.add(i);
				continue;
			}else {
				
				ans[i]=last;
				last=arr[i];
				
				curSize++;
				
				while(curSize<arr[i]&&!empty.isEmpty()) {
					
					ans[empty.remove()]= curSize++;
				}
				
				if(curSize<arr[i]) {
					System.out.println(-1);
					return;
				}
			}
		}
		
		while(!empty.isEmpty()) {
			ans[empty.remove()]=curSize+1;
		}
		
		for(long i: ans) {
			System.out.print(i+" ");
		}
		
		
		
	}

}
