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

Ave = sum(A)/len(A)
# print('Ave:',Ave)
abs_distance = list()

abs_distance.append(int(abs(A[i]-Ave)) for i in range(N))
# for i in range(N):
#     abs_distance.append(int(abs(A[i]-Ave)))
#     # print(int(abs(A[i]-Ave*N)))
# # print(abs_distance)

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