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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.TreeSet;

public class _649 {

	static class Reader {

		final private int BUFFER_SIZE = 1 << 12;
		boolean consume = false;
		private byte[] buffer;
		private int bufferPointer, bytesRead;
		private boolean reachedEnd = false;

		public Reader() {
			buffer = new byte[BUFFER_SIZE];
			bufferPointer = 0;
			bytesRead = 0;
		}

		public boolean hasNext() {
			return !reachedEnd;
		}

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

		private void consumeSpaces() throws IOException {
			while (read() <= ' ' && reachedEnd == false)
				;
			bufferPointer--;
		}

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

		public String next() throws IOException {
			StringBuilder sb = new StringBuilder();
			consumeSpaces();
			byte c = read();
			do {
				sb.append((char) c);
			} while ((c = read()) > ' ');
			if (consume) {
				consumeSpaces();
			}
			;
			if (sb.length() == 0) {
				return null;
			}
			return sb.toString();
		}

		public String nextLine() throws IOException {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String str = br.readLine();
			return str;
		}

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

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

		public double nextDouble() throws IOException {
			consumeSpaces();
			double ret = 0;
			double div = 1;
			byte 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 (consume) {
				consumeSpaces();
			}
			if (neg) {
				return -ret;
			}
			return ret;
		}

		public int[] nextIntArray(int n) throws IOException {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}

		public int[][] nextIntMatrix(int n, int m) throws IOException {
			int[][] grid = new int[n][m];
			for (int i = 0; i < n; i++) {
				grid[i] = nextIntArray(m);
			}
			return grid;
		}

		public char[][] nextCharacterMatrix(int n) throws IOException {
			char[][] a = new char[n][];
			for (int i = 0; i < n; i++) {
				a[i] = next().toCharArray();
			}
			return a;
		}

		public void close() throws IOException {
			if (System.in == null) {
				return;
			} else {
				System.in.close();
			}
		}
	}

	static Reader r = new Reader();
	static PrintWriter out = new PrintWriter(System.out);

	private static void solve1() throws IOException {

		int t = r.nextInt();
		StringBuilder res = new StringBuilder();

		while (t-- > 0) {

			int n = r.nextInt();
			int x = r.nextInt();

			int arr[] = r.nextIntArray(n);
			int prefix[] = new int[n];

			HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
			TreeSet<Integer> set = new TreeSet<Integer>();

			prefix[0] = arr[0];
			if (prefix[0] % x > 0 && prefix[0] % x < x) {
				map.put(prefix[0], 0);
				set.add(prefix[0]);
			}

			for (int i = 1; i < n; i++) {
				prefix[i] += (prefix[i - 1] + arr[i]);
				if (prefix[i] % x > 0 && prefix[i] % x < x && !set.contains(prefix[i])) {
					map.put(prefix[i], i);
					set.add(prefix[i]);
				}
			}

			int ans = 0;
			boolean flag = false;

			for (int i = n - 1; i >= 0; i--) {
				if ((prefix[i] % x) != 0) {
					flag = true;
					ans = Math.max(ans, i + 1);
					break;
				} else {
					if (!set.isEmpty()) {
						int temp = set.first();
						int idx = map.get(temp);
						if (idx < i) {
							ans = Math.max(ans, i - idx);
							flag = true;
						}
					}
				}
			}

			res.append(flag ? ans : -1).append("\n");

		}

		out.print(res);
		out.close();

	}

	private static void solve2() throws IOException {

		int t = r.nextInt();
		StringBuilder res = new StringBuilder();

		while (t-- > 0) {

			int n = r.nextInt();

			int arr[] = r.nextIntArray(n);

			StringBuilder ans = new StringBuilder();
			ans.append(arr[0] + " ");

			int cnt = 2;
			char prev = '+';

			for (int i = 1; i < n; i++) {
				if (prev == '+' && arr[i] - arr[i - 1] < 0) {
					prev = '-';
					if (i > 1) {
						ans.append(arr[i - 1] + " ");
						cnt++;
					}
				} else if (prev == '-' && arr[i] - arr[i - 1] > 0) {
					prev = '+';
					ans.append(arr[i - 1] + " ");
					cnt++;
				}
			}
			ans.append(arr[n - 1]);

			res.append(cnt + "\n" + ans).append("\n");

		}

		out.print(res);
		out.close();

	}

	private static void solve3() throws IOException {

		int n = r.nextInt();
		int arr[] = new int[n];

		boolean visited[] = new boolean[(int) 1e6 + 1];
		boolean flag = true;

		for (int i = 0; i < n; i++) {
			visited[arr[i] = r.nextInt()] = true;
			if (arr[i] > i + 1) {
				flag = false;
			}
		}

		if (!flag) {
			out.print(-1);
			out.close();
			return;
		}

		int ans[] = new int[n], cnt = 0;
		Arrays.fill(ans, -1);

		for (int i = 1; i < n; i++) {
			if (arr[i] != arr[i - 1]) {
				cnt++;
				ans[i] = arr[i - 1];
			}
		}

		cnt = (n - cnt);
		ArrayList<Integer> non_vis = new ArrayList<Integer>();

		for (int i = 0; i <= (int) 1e6 && cnt > 0; i++) {
			if (!visited[i]) {
				cnt--;
				non_vis.add(i);
			}
		}

		int idx = 0;
		for (int i = 0; i < n; i++) {
			if (ans[i] == -1) {
				ans[i] = non_vis.get(idx++);
			}
		}

		for (int i = 0; i < n; i++) {
			out.print(ans[i] + " ");
		}

		out.close();

	}

	private static void solve4() throws IOException {

		int t = r.nextInt();
		StringBuilder res = new StringBuilder();

		while (t-- > 0) {

			int n = r.nextInt();

			res.append(false).append("\n");
		}

		out.print(res);
		out.close();

	}

	private static void solve5() throws IOException {

		int t = r.nextInt();
		StringBuilder res = new StringBuilder();

		while (t-- > 0) {

			int n = r.nextInt();

			res.append(false).append("\n");
		}

		out.print(res);
		out.close();
	}

	private static void solve6() throws IOException {

		int t = r.nextInt();
		StringBuilder res = new StringBuilder();

		while (t-- > 0) {

			int n = r.nextInt();

			res.append(false).append("\n");
		}

		out.print(res);
		out.close();
	}

	public static void main(String[] args) throws IOException {

//		solve1();

//		solve2();

		solve3();

//		solve4();
//
//		solve5();
//
//		solve6();

	}

}