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

import static java.lang.Math.*;
import static java.util.stream.Collectors.*;

public class Main {


    void solve(){
        int n = in.nextInt();
        int[] arr = in.nextInts(n), ans = new int[n],visited = new int[n+1];
        boolean legal = true;
        Arrays.fill(ans,-1);
        for(int i=0;i<n;i++){
            visited[arr[i]] = 1;
            if(arr[i]>i+1){
                System.out.println(-1);
                return;
            }
            if(i!=0&&arr[i]!=arr[i-1]){
                ans[i] = arr[i-1];
            }
        }
        int num = 0;
        for(int i=0;i<n;i++){
            if(ans[i]==-1){
                while(visited[num]==1) num++;
                ans[i] = num++;
            }
        }
        out.println(ans);
    }
    void solve1() {
        int n = in.nextInt();
        int[] a = in.nextInts(n);
        boolean[] has = new boolean[n+1];
        for (int el : a) {
            has[el] = true;
        }
        int[] b = new int[n];
        int i1 = 1;

        if (0 != a[0]){
            b[0] = 0;
        }else {
            while (has[i1])i1++;
            b[0] = i1++;
        }

        for (int i = 1; i < n; i++) {
            if (a[i-1] != a[i]){
                b[i] = a[i-1];
            }else {
                while (has[i1])i1++;
                b[i] = i1++;
            }
        }
        out.println(b);
    }

    static final boolean MULTI_TEST = false;

    // --------------------------------------------------------------------------------------------------------------
    // --------------------------------------------------HELPER------------------------------------------------------
    // --------------------------------------------------------------------------------------------------------------


    void solve2() {
//        init();
        if (MULTI_TEST) {
            int t = in.nextInt();
            for (int i = 0; i < t; i++) {
                solve();
            }
        } else {
            solve();
        }
    }

    // --------------------ALGORITHM-------------------------

    public void sort(int[] arr) {
        List<Integer> tmp = Arrays.stream(arr).boxed().sorted().collect(Collectors.toList());
        for (int i = 0; i < arr.length; i++) {
            arr[i] = tmp.get(i);
        }
    }

    // --------------------SCANNER-------------------------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner(boolean debug) {
            if (debug) {
                try {
                    br = new BufferedReader(new FileReader("input.txt"));
                } catch (FileNotFoundException e) {
                    throw new RuntimeException(e);
                }
            } else {
                br = new BufferedReader(new InputStreamReader(System.in));
            }
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                st = new StringTokenizer(nextLine());
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextInts(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        public long[] nextLongs(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            try {
                String line = br.readLine();
                if (line == null) {
                    throw new RuntimeException("empty line");
                }
                return line;
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }

    // --------------------WRITER-------------------------
    public static class MyWriter extends PrintWriter {

        public MyWriter(OutputStream out) {
            super(out);
        }

        void println(int[] arr) {
            String line = Arrays.stream(arr).mapToObj(String::valueOf).collect(joining(" "));
            println(line);
        }

    }
    // --------------------MAIN-------------------------

    public MyScanner in;
    public MyWriter out;

    public static void main(String[] args) {
        Main m = new Main();
        m.in = new MyScanner(args.length > 0);
        m.out = new MyWriter(new BufferedOutputStream(System.out));
        m.solve2();
        m.out.close();
    }
}


// class Pair{
//    Integer key, value;
//     Pair(int _key,int _value){
//        key = _key;
//        value = _value;
//    }
//    @Override
//    public int hashCode() {
//        return (key ==null?0: key.hashCode()) ^(value ==null?0: value.hashCode());
//    }
//
//    @Override
//    public boolean equals(Object obj) {
//        if(obj==null) return false;
//        Pair a = (Pair)obj;
//        return this.key.equals(a.key)&&this.value.equals(a.value);
//    }
//}




