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