N = int(input())

A = list(map(int,input().split()))

AVE = sum(A)/len(A)
DIFF = 1000.0
Samu = 0
for i in range(N):
    a = A[i]
    if abs(AVE-a) < DIFF:
        DIFF = AVE-a
        Samu = i
    #print(i,Samu,DIFF)
        
print(Samu)