N = int(input())

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

goke = 0
ans = 0

for i in range(len(a)):
    goke += a[i]

ave = goke / N

ans = 0
for i in range(len(a)-1):
    if abs(ave - a[i]) < abs(ave - a[i+1]):
        ans = i

print(ans)