import copy
N = int(input())
A = list(map(int,input().split()))
B = copy.copy(A)
A.sort()
ave = sum(A)/N

ok = 0
ng = N
while abs(ng-ok)>1:
  mid = (ok+ng)//2
  if A[mid] <= ave:
    ok = mid
  else:
    ng = mid
ans = A[ok]

for i in range(N):
  if B[i] == ans:
    print(i)
    exit()
            