n = gets.to_i
a = gets.split.map(&:to_i)
s = a.inject(:+)
a.map!{|v|v*n}

mini = 10**10
ans = 0
(n-1).downto(0) do |i|
  diff = (a[i] - s).abs
  if diff <= mini
    mini = diff
    ans = i
  end
end
puts ans