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 os
import heapq
import sys
import bisect
import math
import operator
from collections import defaultdict
from io import BytesIO, IOBase

# def gcd(a,b):
#     if b==0:

#         return a
#     else:
#         return gcd(b,a%b)
def inar():
    return [int(k) for k in input().split()]
def main():

    #for _ in range(int(input())):
    n=int(input())
    #n,x=map(int,input().split())
    arr=inar()
    #st=list(input())
    res=[-1]*(n+1)
    value=[0]*(10**5+5)
    arr.insert(0,0)
    lst=0
    for i in range(1,n+1):
        if arr[i]!=arr[i-1]:
            res[i]=arr[i-1]
            value[arr[i-1]]=1
    value[arr[n]]=1
    m=0
    for i in range(1,n+1):
        while value[m]:
            m+=1
        if res[i]==-1:
            res[i]=m
            value[m]=1
    
    # ls=[]
    # heapq.heapify(ls)
    # counter=0
    # print(res)
    # for i in range(1,n+1):
    #     heapq.heappush(ls,res[i])
    #     mn=heapq.heappop(ls)
    #     heapq.heappush(ls,mn)
    #     if (mn+1)!=arr[i]:
    #         print(arr[i])
    #         counter=1
    #         break
    # if counter==1:
    #     print(-1)
    # else:
    print(*res[1:n+1])

















BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()