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

g = 0

for x in range(len(a)):
    g += a[x]

g = g/n
i = 0
y = abs(g-a[0])

for x in range(len(a)):
    if y>abs(g-a[x]):
        i = x

print(i)
