N = int(input())
a = list(map(int,input().split()))
average = sum(a) / N
A = list(map(lambda n:abs(n-average), a))
A.sort()
A1 = int(average - A[0])
if A1 in a:
    print(a.index(A1))
else:
    print(a.index(int(average + A[0])))
