import numpy as np

n = int(input())
alst = list(map(int, input().split()))
ans = 0
ave = np.average(alst)
d = abs(ave - alst[0])

for i, num in enumerate(alst):
    d_tmp = abs(ave - num)
    if d_tmp < d:
        ans = i
print(ans)