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

while n > 0
  if (i = b.rindex.with_index { |e, idx| e == n - idx })
    b.delete_at(i)
    arr << i + 1
    n -= 1
  else
    puts -1
    exit
  end
end

puts arr.reverse