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.
def checking_for_correctness(array_to_check):
    for ind, a_i in enumerate(a):
        if ind + 1 < a_i:
            return False
    return True



n = int(input())
a = [int(i) for i in input().split()]

unique_elements = [el for el in set(a)][::-1]
set_of_unique_elements = set(a)

# print(unique_elements)

b = []

# if a[0] != 0:
next = unique_elements.pop()
current_num = 0
for a_i in a:
    while current_num in set_of_unique_elements:
        current_num += 1
    if a_i == next and a_i != a[0]:
        b.append(last)
        next = unique_elements.pop() if unique_elements else next
    elif a_i == next and a_i == a[0]:
        next = unique_elements.pop() if unique_elements else next
        b.append(current_num)
        current_num += 1
    else:
        b.append(current_num)
        current_num += 1

    last = a_i
# else:
#     next = unique_elements.pop()
#     current_num = 0
#     for a_i in a:
#         if a_i == 0:
#             b.append(1)
#             next = unique_elements.pop() if next == 0 else next
#         else:
#             if a_i == next:
#                 b.append(current_num)
#                 next = unique_elements.pop() if unique_elements else next
#                 current_num = a_i
#             else:
#                 if current_num != 0 and current_num + 1 < next:
#                     current_num += 1
#                     b.append(current_num)
#                 elif current_num == 0 and current_num + 2 < next:
#                     current_num += 2
#                     b.append(current_num)
#                 else:
#                     b.append(current_num)


print(*b if checking_for_correctness(b) else [-1])

