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

Ave = sum(A)/len(A)
abs_distance =list()

for i in range(len(A)):
    abs_distance.append(int(abs(A[i]-Ave)))

print(abs_distance.index(min(abs_distance)))