import math

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

result = 0
for i in range(N):
    if A[i] == avg:
        result = i
        break
    if A[i] == avg2:
        result = i
print(result)