integer N
integer,allocatable,dimension(:)::b
integer,allocatable,dimension(:)::ans
read*,N
allocate(b(N),ans(N))
read*,b
do i=N,1,-1
  do j=i,0,-1
    if(j==0)then
      print"(i0)",-1
      stop
    endif
    if(b(j)==j)then
      ans(i)=j
      b=[b(:j-1),b(j+1:)]
      exit
    endif
  end do
end do

print"(i0)",ans

end