N = int(input())
data = list(map(int, input().split()))
ave = sum(data) / len(data)
ans = 0
for i in range(len(data)):
  if int(abs(data[i] - ave)) < int(abs(data[ans] - ave)):
    ans = i

print(ans)
