n = gets.to_i
bs = gets.chomp.split(' ').map(&:to_i).sort.reverse
xs = []
result = 0
x = 0
(n..1).each do |x|
  a = find {|b| b >= x}
  if a.nil?
    result = -1
    break
  end
  xs << a
end

if result == -1
  print -1
else
  xs.each do |x|
    print x
  end
end