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

keys = [i for i in range(N)]
adict = dict(zip(keys, a))

ave = 0
for i in range(N):
    ave =  ave + a[i]/len(a)
    

mat =[]
for i in range(N):
    mat.append(a[i]-ave)

amin = min(mat)


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

print(min(keys))

