def main(argv)
  n = gets.chomp.to_i
  a = gets.chomp.split(' ').map(&:to_i)

  avg = a.reduce(:+).to_f / n.to_f

  min_diff = 100.0
  min_index = -1
  n.times do |i|
    diff = (a[i] - avg).abs

    if min_diff < diff then
      min_diff = diff
      min_index = i
    end
  end

  puts min_index.to_i
end

if self.to_s == 'main' then
  main(ARGV)
end