n = gets.chomp.to_i
a = gets.split.map(&:to_i)
mean = a.reduce(:+).to_f / n.to_f
min = 10000
ans = 0
0.upto(n-1) do |i|
  diff = (mean - a[i]).abs
  if min > diff
    ans = i
    min = diff
  end
end
puts ans
