n = gets.to_i
as = gets.split.map{|i|i.to_i}

ave = as.inject(:+) / as.length
min = 1000
min_index = 100

0.upto(n-1) do |i|
  if min > (as[i] - ave).abs
    min = (as[i] - ave).abs
    min_index = i
  end
end

puts min_index