n=int(input())
a=input().split()
a=list(map(int,a))
mean=sum(a)/len(a)
for i in range(n):
    a[i]=abs(a[i]-mean)
min=a[0]
j=0
for i in range(n):
    if  a[i]<a[0]:
        min=a[i]
        j=i
print(j)