n = gets.chomp.to_i
ary = gets.chomp.split.map(&:to_i)

mean = ary.inject(:+)/(ary.length*1.0)

min = Float::INFINITY
index = 0
ary.each_with_index do |item,i|
  item -= mean
  if item.abs < min
    min = item.abs
    index = i
  end
end

puts index
