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.nio.charset.IllegalCharsetNameException;
import java.util.*;
import java.io.*;
//Captain on duty!



public class Main {

    static void compare(Main.pair a[], int n) {

        Arrays.sort(a, new Comparator<Main.pair>() {
            @Override
            public int compare(Main.pair p1, Main.pair p2) {
                return p1.f - p2.f;
            }
        });
    }

    public static boolean checkPalindrome(String s) {
        // reverse the given String
        String reverse = new StringBuffer(s).reverse().toString();

        // check whether the string is palindrome or not
        if (s.equals(reverse))
            return true;

        else
            return false;
    }

    static class pair implements Comparable {
        int f;
        int s;

        pair(int fi, int se) {
            f = fi;
            s = se;
        }

        public int compareTo(Object o)//desc order
        {
            pair pr = (pair) o;
            if (s > pr.s)
                return -1;
            if (s == pr.s) {
                if (f > pr.f)
                    return 1;
                else
                    return -1;
            } else
                return 1;
        }

        public boolean equals(Object o) {
            pair ob = (pair) o;
            if (o != null) {
                if ((ob.f == this.f) && (ob.s == this.s))
                    return true;
            }
            return false;
        }

        public int hashCode() {
            return (this.f + " " + this.s).hashCode();
        }


    }

    public static boolean palin(int l, int r, char[] c) {
        while (l <= r) {
            if (c[l] != c[r]) return false;
            l++;
            r--;
        }
        return true;
    }


    public static long gcd(long a, long b) {
        if (b == 0)
            return a;

        return gcd(b, a % b);
    }
    public static long lcm(long a, long b)
    {
        return (a*b)/gcd(a, b);
    }

    public static long hcf(long a, long b) {
        long t;
        while (b != 0) {
            t = b;
            b = a % b;
            a = t;
        }
        return a;
    }

    public static boolean isPrime(long n) {
        if (n <= 1)
            return false;

        // Check from 2 to n-1
        for (int i = 2; i <= Math.sqrt(n) + 1; i++)
            if (n % i == 0)
                return false;

        return true;
    }

    public static String reverse(String str) {
        String str1 = "";
        for (int i = 0; i < str.length(); i++) {
            str1 = str1 + str.charAt(str.length() - i - 1);
        }
        return str1;
    }

    public static double fact(long a) {
        if (a == 1)
            return 1;
        else
            return a * fact(a - 1);
    }

    static boolean isPerfectSquare(double x)
    {

        // Find floating point value of
        // square root of x.
        double sr = Math.sqrt(x);

        // If square root is an integer
        return ((sr - Math.floor(sr)) == 0);
    }


    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

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

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

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

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }


    }


    public static void main(String[] args) {
        FastReader s = new FastReader();
        //System.out.println("Forces Babyy!!");


        int n = s.nextInt();
        HashSet h=new HashSet();
        int[] a=new int[n];
        for(int i=0;i<n;i++)
        {
            a[i]=s.nextInt();
            h.add(a[i]);
        }
        int f=0;
        for(int i=0;i<n;i++)
        {
            if(a[i]>(i+1))
            {
                f=1;
                break;
            }
        }
        if(f==1)
            System.out.println(-1);
        else {
            int main_ct;
            int[] b = new int[n];
            if (a[0] == 1)
            {
                b[0] = 0;

            }
            else
            {
                b[0] = 1;
            }
            int[] vis=new int[n+1];
            for(int i=0;i<n;i++)
            {
                vis[a[i]]=1;
            }
            ArrayList not=new ArrayList();
            for(int i=1;i<=n;i++)
            {
                if(vis[i]==0)
                    not.add(i);
            }


            main_ct=0;

            boolean flag = false;


            if (a[0] == 1) {
                for (int i = 1; i < n; i++) {
                    if (a[i] != a[i - 1]) {
                        if(a[i-1]==1 && a[i]==0)
                        {
                            f=1;
                            break;
                        }

                        b[i] = a[i-1];



                    } else {

                            b[i] = (int) not.get(main_ct);
                            main_ct++;


                    }
                }
                if(f==1)
                    System.out.println(-1);
                else {
                    for (int i = 0; i < n; i++)
                        System.out.print(b[i] + " ");
                    System.out.println();
                }
            }
            else
            {
                b[0]=1;

                for(int i=1;i<n;i++)
                {
                    if(a[i]!=a[i-1] && !(flag))
                    {
                        if(a[i-1]==0 && a[i]==1)
                        {
                            f=1;
                            break;
                        }
                        b[i]=0;
                        flag=true;
                    }
                    else if(a[i]!=a[i-1])
                    {
                        if(a[i-1]==0 && a[i]==1)
                        {
                            f=1;
                            break;
                        }


                        b[i] = a[i-1];


                    }
                    else
                    {

                        b[i] = (int) not.get(main_ct);
                        main_ct++;
                    }
                    if(f==1)
                        break;
                }
                if(f==1)
                    System.out.println(-1);
                else {
                    for (int i = 0; i < n; i++)
                        System.out.print(b[i] + " ");
                    System.out.println();
                }
            }
        }






    }
}

