N = int(input())
a = sorted([(i, int(x)) for i, x in enumerate(input().split())], key=lambda x: x[1])
avg = sum([l[1] for l in a]) / N
d = 999999999999
t = -1
pre = -1
for i, n in a:
    if n == pre:
        continue
    p = n - avg if n >= avg else avg - n
    if p == 0:
        t = i
        break
    elif p < d:
        d = p
        t = i
    else:
        break
print(t)