n = int(raw_input())
ar = map(int, raw_input().split())

s = sum(ar)

margin = 9999999999999999999999999999999999999
pos = -7

for i in xrange(n):
    if abs(n * ar[i] - s) < margin:
        margin = abs(n * ar[i] - s)
        pos = i

print pos