N = int(input())
a = list(map(int,input().split()))
average = sum(a) / N
A = list(map(lambda n:abs(n-average), a))
A.sort()
A1 = int(average - A[0])
A2 = int(average + A[0])
if A1 in a:
    B1 = a.index(A1)
else:
    B1 = 10**18
if A2 in a:
    B2 = a.index(A2)
else:
    B2 = 10**18

print(min(B1, B2))
