import math

N = int(raw_input())
A = [int(x) for x in raw_input().split()]
a = sum(A)/N
tmp=99999999
ans=0
for i in range(N):
    if abs(a-A[i]) < tmp:
        tmp =abs(a-A[i])
        ans =i
print ans
