N = int(input())
A = list(map(int,input().split()))
avg = 0
for a in A:
    avg += a
avg = avg / N
B = sorted(A)
target = 0
for b in B:
    dif1 = abs(target-avg)
    dif2 = abs(b-avg)
    if dif2 < dif1:
        target = b
    else:
        break
ans = 0
for i,a in enumerate(A):
    if a == target:
        ans = i
        break
print(ans)