n = int(input())
framelist = [int(i) for i in input().split()]

sum = 0


for i in range(n):
  sum += framelist[i]

avg = sum /n

min = avg

for i in range(n):
  difference = abs(framelist[i]-avg)
  if min>difference:
    min = difference
    
print(framelist.index(difference))