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

ans = []
n.downto(1) do |i|
  i.downto(1) do |j|
    if b[j -1] == j
      b.delete_at(j - 1)
      ans.insert(0, j)
      break
    end
  end
  if b.size == i
    puts -1
    exit
  end
end

puts ans.join("\n")
