N=gets.to_i
b=gets.split.map &:to_i
r=""
while !b.empty? do
    f=0
    (b.size-1).downto(0){|j|
        if b[j]==j+1 then
            r=(j+1).to_s+"\n"+r
            b.delete_at(j)
            f=1
            break
        end
    }
    if f==0 then 
        p -1
        exit
    end
end
puts r