n = gets.chomp.to_i
arr = gets.chomp.split(' ').map(&:to_i)
(0...n).each do |i|
  if arr[i] > i + 1
    puts '-1'
    exit(0)
  end
end
list = []
while arr.count > 0
  delete_index = 0
  (1...arr.count).each do |i|
    item = arr[i]
    if i + 1 == item
      delete_index = i
    end
  end
  list << arr[delete_index]
  arr.delete_at(delete_index)
end
puts list.reverse