import sys

N = int(sys.stdin.readline())

A = map(int, sys.stdin.readline().strip().split(" "))

avg = 1. * sum(A) / N

near = 9999999
idx = -1
for i, a in enumerate(A):
    if near > abs(a-avg):
        near = abs(a-avg)
        idx = i

print(idx)
