n = gets

b = gets.split.map(&:to_i)

def func(seq)
  return [] if seq.empty?
  res = seq.select.with_index(1) do |item, index|
    item == index
  end.map do |i|
    func(seq.dup.tap{|s| s.delete_at(i-1) })&.push(i)
  end.compact
  if res.empty? then nil else res.first end
end

ans = func(b)

if ans
  ans.each do |i|
    puts i
  end
else
  puts -1
end
