N = int(input())
at = input().split(" ")
a = []
for i in at:
    a.append(int(i))
avg = sum(a) / N
mdif, flag = abs(a[0]-avg), 0
for i in range(len(a)):
    if a[i]-avg < mdif:
        mdif = a[i] - avg
        flag = i
print(flag)
