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.*;
import java.util.*;

public class C { //

    static int[] a, b, q;

    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
            int len = Integer.parseInt(br.readLine());
            a = new int[len];
            b = new int[len];
            q = new int[len];
            String[] line = br.readLine().split(" ");
            for (int i = 0; i < len; i++) {
                a[i] = Integer.parseInt(line[i]);
            }
            br.close();

            int read = 0;
            int write = 0;
            Arrays.fill(b, len + 1);
            if (a[0] == 0) write++;
            else if (a[0] == 1) b[0] = 0;

            for (int i = 1; i < len; i++) {
                if (a[i] == a[i - 1]) {
                    q[write] = i;
                    write++;
                }
                else if (a[i] - a[i - 1] > write - read + 1) {
                    System.out.println("-1");
                    return;
                }
                else {
                    int curVal = a[i - 1] + 1;
                    for (; curVal < a[i]; read++) {
                        b[q[read]] = curVal;
                        curVal++;
                    }
                    b[i] = a[i - 1];
                }
            }

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < len; i++) {
                sb.append(b[i] + " ");
            }
            sb.append("\n");
            bw.write(sb.toString());
            bw.close();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

    public static void dbug(String s, long ... a) { // /*
        String[] line = s.split("<>");
        for (int i = 0; i < a.length; i++) {
            System.out.print(line[i] + a[i]);
        }
        System.out.println(line[a.length]); // */
    }

    public static void print(int[] a) { // /*
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i] + " ");
        }
        System.out.println(); // */
    }
}