n = gets.to_i
b = gets.split.map(&:to_i)

ans = []
while b != []
    j = true
    (n-1).downto(0) do |i|
        if b[i] == i + 1
            ans.unshift(i + 1)
            b.delete_at(i)
            j = false
            break
        end
    end

    if j
        puts -1
        exit
    end
    n -= 1
end

puts ans