n= int(input())
lis = list(map(int,input().split()))
cou = 0
num = sum(lis)/n
for i in range(n):
  lis[i] -= num
  cou = min(cou,abs(lis[i]))
for i in range(n):
  if cou == abs(lis[i]):
    print(i)
    exit()
