n = gets.to_i
b = gets.split.map(&:to_i)
for i in 0..n-1
    if b[i] > i+1
        puts -1
        exit
    end
end
a = []
(n-1).downto(0) do |i|
    i.downto(0) do |j|
        if b[j] == j+1
            a.push(j+1)
            b.delete_at(j)
            break
        end
    end
end
puts a.reverse