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

avg = 0
for i in range(N):
    avg += a[i]
avg /= N
a = list(set(a))
result = 100


if avg in a:
    result = a.index(avg)
else:
    for i in range(len(a)):
        temp = abs(avg-a[i])
        if temp <= result:
            result = temp
    result = a.index(round(result))
print(result)
