N = int(input())
li = list(map(int, input()split()))

s = sum(li)
mean = s / N

li_div = [ ]
for i in range(N):
	div = abs(li[i] - mean)
	li_div.append(div)

min_div = min(li_div)

for i in range(N):
	if li_div == min_div:
		print(i)
		break
