N = STDIN.gets.chomp.to_i
a = STDIN.gets.chomp.split(' ').map(&:to_i)

max = 0
avg = a.inject(0) do |s, v|
  max = v if v > max
  s + v
end / a.size.to_f

mindiff = max
minindex = 0
a.each_with_index do |v, i|
  diff = (v.to_f - avg).abs
  if diff < mindiff
    mindiff = diff
    minindex = i
  end
end

puts minindex
