N = input()
a = map(int, raw_input().split())

keys = [i for i in range(N)]


ave = 0
newa = []
for j in range(N):
    ave =  ave + a[j]
    newa.append(a[j]*N)
      
adict = dict(zip(keys, newa))
    
mat =[]
for i in range(N):
    mat.append(abs(newa[i]-ave))
    

amin = min(mat)


keys = [k for k, v in adict.items() if abs(v-ave) == amin]


print(min(keys))

