import numpy as np
n = int(input())
a = list(map(int, input().split()))

a_mean = np.array(a).mean()

min_a = 100000000
index = 0
for i in range(len(a)):
    if min_a > abs(a_mean - a[i]):
        index = i
        min_a = a_mean - a[i]
print(index)