#!/usr/bin/env python

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

N = input()
a = map(int, raw_input().split())

S = sum(a)

ans = 0
diff = INF

for i in range(N):
    if diff > abs(S - a[i] * N):
        diff = S - a[i] * N
        ans = i

print ans