n = gets.to_i
ary = gets.split().map(&:to_i)
ary2 = []
num = 1
max = 0
ary.each do |a|
  if a == num
    ary2 << a
    num += 1
    max = num
  end
end
if max == 0
  puts -1
else
  puts n - ary2.length
end