N = gets.to_i
b = gets.split.map(&:to_i)
ans = []
diff = []
N.times do |i|
  diff << i+1 - b[i]
  if i+1 - b[i] < 0
    p -1
    exit
  end
end
#p diff
N.times do |i|
  t = 0
  diff.length.times do |j|
    if diff[-j-1] <= i
      t = -j -1
      break
    end
  end

  ans << b[t]
  diff.delete_at(t)
  b.delete_at(t)
end

ans.reverse.each do |v|
  p v
end
