n = int(input())
a = list(map(int,(input().split())))
tmp = [sum(a)/n for i in range(n)]
average = tmp[0]#これに一番近いもの

x = []

for i in range(n):
    tmp1 = a[i] - average
    if tmp1 < 0:
        tmp1 = tmp1 * -1
    x.append(tmp1)

tmp2 = x[i]
counter = 0
for i in range(1,n-1):
    if tmp2 < x[i]:
        result = x.index(x[i])
    else:
        result = 0

hantei = set(x)
if len(hantei) == 1:
    print(0)
else:
    print(result)
