local N = io.read("n")
local b = {}
for i=1,N do
    b[i] = io.read("n")
end
local ans = {}

for i=N,1,-1 do
    for jj=i,1,-1 do
        if b[jj] == jj then
            table.remove(b, jj)
            ans[i] = jj
            break
        end
    end
    if ans[i] == nil then
        print(-1)
        return
    end
end

for i=1,N do
    print(ans[i])
end
