n = gets.to_i
b = gets.split.map(&:to_i)
ans = []
n.times do |i|
    (n-i-1).downto(0) do |j|
        if b[j] == j+1
            ans << j+1
            b.delete_at(j)
            break
        elsif b[j] > j+1
            puts "-1"
            exit
        end
    end
end
puts ans.reverse