from statistics import mean
n = int(input())
a = list(map(int, input().split()))

m = mean(a)
Min = abs(a[0]-m)
ret = [0]

for i in range(1, len(a)):
    if abs(a[i]-m) < Min:
        Min = abs(a[i]-m)
        ret.append(i)

if len(ret) > 1:
    print(ret[1])
else:
    print(ret[0])