n = int(input())
a = list(map(int, input().split()))
a.sort()
avg = sum(a) / n
a = list(map(lambda x: abs(x - avg), a))
ans = 10 ** 9 + 7
ans_item = 10 ** 9 + 7

for i in range(n):
    if ans_item > a[i]:
        ans = i
        ans_item = a[i]

print(ans)
