n = int(input())
a = list(map(int, input().strip().split()))
s = 0
for i in range(n):
	s += a[i]
mn = abs(a[0] * n - s)
ans = 0
for i in range(1, n):
	if (abs(a[i] * n - s) < mn):
		mn = a[i] * n - s
		ans = i
print(ans)
