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

ma = sum(a) / len(a)

l = 0
u = len(a)-1
for i in range(len(a)):
    if a[i] <= ma and a[l] < a[i]:
        l = i
    if a[i] >= ma and a[u] > a[i]:
        u = i

if (ma - a[l]) <= (a[u] - ma):
    print(l)
else:
    print(u)

