n = int(input());
mylist = list(map(int, input().split()));
sum = 0;
for k in mylist:
	sum += k;
sum /= len(mylist);
maxi = 0;
for i in range(len(mylist)):
	if ((mylist[maxi] > sum or mylist[maxi] < mylist[i]) and mylist[i] <= sum):
		maxi = i;
print(maxi);