n = gets.to_i
b = gets.chomp.split.map(&:to_i)
a = []

loop do
  break if n == 0

  found = false
  (n - 1).step(0, -1) do |i|
    if i + 1 == b[i]
      a.unshift(i + 1)
      b.delete_at(i)
      found = true
      break
    end
  end
  
  if !found
    puts "-1"
    exit
  end
  n -= 1
end
puts a