from sys import stdin

a = []
sum = 0

n = int(stdin.readline().rstrip())
a = [int(y) for y in stdin.readline().rstrip().split()]

for i in range(n) :
    sum = sum + a[i]

ave = sum / n
tmp = abs(a[0] - ave)
ans = 0

for i in range(n) :
    if (abs(a[i] - ave) < tmp ) and ( a[ans] is not a[i]):
        ans = i

print(ans)

