from bisect import bisect_left
N,*a = map(int,open(0).read().split())
average = sum(a) // N
b = bisect_left(a,average)
dif = min(average - a[b-1], a[b] - average)
for i in range(N):
    if abs(a[i] - average) == dif:
        print(i)
        exit()