def dfs(a, xs)
  return [true, xs] if a.size == 0

  is = []
  a.size.times{|i| is.push(i) if a[i] == i }
  return [false, []] if is.size == 0

  a.delete_at(is[is.size - 1])
  xs.push(is[is.size - 1])

  ret = dfs(a, xs)
  if ret[0] then
    return ret
  else
    return [false, nil]
  end
end

def main(argv)
  n = gets.chomp.to_i
  b = gets.chomp.split(' ').map(&:to_i)
  
  b.map!{|x| x - 1}
  ret = dfs(b, [])
  if ret[0] then
    ret[1].reverse.map{|x| x + 1}.each do |x|
      puts x.to_s
    end
  else
    puts (-1).to_s
  end
end

if self.to_s == 'main' then
  main(ARGV)
end