n = gets.to_i
a = gets.split.map(&:to_i)
sum = 0
a.each do |v|
  sum += v
end
avg = sum / n.to_f
minDiff = avg
ans = nil
n.times do |i|
  diff = (a[i] - avg).abs
  if diff < minDiff
    ans = i
    minDiff = diff
  end
end
p ans
