n = int(input())
p = input()
o = p.split()
k = []
for i in range(n):
    k.append(int(o[i]))
a = sum(k)/n
l = 99999
m = None
for i in range(n):
    w = k[i]
    if (abs(w - a) < l):
        m = i
        l = abs(w - a)
print(m)