N = int(input())
A = list(map(int, input().split()))
sums = sum(A)/N
avg = round(sums)
avg2 = avg+1 if avg == int(sums) else avg-1

tmp = 100
result = 0
for i in range(N):
    if A[i] == avg:
        result = i
        break
    if A[i] == avg2 and tmp > i:
        tmp = i

print(result if result < tmp else tmp)