def get_int
  gets.chop.to_i
end

def get_ints
  gets.chop.split.map(&:to_i)
end

def get_double
  gets.chop.to_f
end

def get_str
  gets.chop
end

def get_strs
  gets.chop.split
end

def main
  n = get_int
  a_arr = get_ints
  k = 1
  0.upto(n-1) do |i|
    a = a_arr[i]
    if a != k
      # pass
    else
      k += 1
    end
  end
  if k == 1
    puts -1
  else
    puts n - k + 1
  end
end

if __FILE__ == $0
  main
end