from queue import Queue



def solve():

    N = int(eval(input()))

    b = list(map(int, input().split()))

    idx = [i+1 for i in reversed(list(range(N)))]

    

    l = []

    for i in range(N):

        for bi, j in zip(reversed(b), idx):

            if j == bi:

                l.append(str(j))

                break

        del idx[0], b[j-1]

    

    return '\n'.join(reversed(l)) if len(l) == N else -1



print((solve()))
def solve():

    N = input()

    a = ['']

    for i in input().split():

        a.insert(int(i)-1, i)

    print(*a[-1]and[-1]or a)



solve()

from queue import Queue


def solve():
    N = int(eval(input()))
    b = list(map(int, input().split()))
    idx = [i + 1 for i in reversed(list(range(N)))]
    l = []
    for i in range(N):
        for bi, j in zip(reversed(b), idx):
            if j == bi:
                l.append(str(j))
                break
        del idx[0], b[j - 1]
    return "\n".join(reversed(l)) if len(l) == N else -1


print((solve()))

def solve():
    N = input()
    a = [""]
    for i in input().split():
        a.insert(int(i) - 1, i)
    print(*a[-1] and [-1] or a)


solve()

-from queue import Queue +def solve(): +    N = input() +    a = [""] +    for i in input().split(): +        a.insert(int(i) - 1, i) +    print(*a[-1] and [-1] or a) -def solve(): -    N = int(eval(input())) -    b = list(map(int, input().split())) -    idx = [i + 1 for i in reversed(list(range(N)))] -    l = [] -    for i in range(N): -        for bi, j in zip(reversed(b), idx): -            if j == bi: -                l.append(str(j)) -                break -        del idx[0], b[j - 1] -    return "\n".join(reversed(l)) if len(l) == N else -1 - - -print((solve())) +solve()