# coding:utf-8

import sys

input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


N = int(input())
A = inpl()
B = set(A)
m = sum(A)/N
tmp = INF
min_num = A[0]
for b in B:
    if abs(b - m) < tmp:
        tmp = abs(b - m)
        min_num = b

print(A.index(min_num))
