N = gets.to_i
B = gets.split.map(&:to_i)

ans = []

N.downto(1) do |n|
  updated = false

  (n - 1).downto(0) do |j|
    if B[j] == j + 1
      ans << j + 1
      B.delete_at(j)
      updated = true
      break
    end
  end

  if !updated
    puts -1
    exit
  end
end

puts ans.reverse
