program AGC032A
    implicit none
    integer(8)::N,i,j
    integer(8)::flg=0
    integer(8)::same,count
    integer(8),allocatable,dimension(:)::A,B

    read(5,*)N
    allocate(A(N))
    allocate(B(N))
    read(5,*)(B(i),i=1,N)

    do i=1,N
        if(B(i)>i)then
            flg=1
        end if
    end do

    if(flg==1)then
        print'(i0)',-1
    else
        do i=1,N
            same=1
            count=1
            do j=1,N
                if(B(j)/=0)then
                    if(B(j)==count)then
                        same=j
                    end if
                    count=count+1
                end if
            end do
            
            A(i)=B(same)
            B(same)=0
        end do

        do i=1,N
            print'(i0)',A(N-i+1)
        end do
    end if
    
end program AGC032A