import numpy as np

n = int(input())
a = list(map(int, input().split()))

avg = int(np.average(a))

def delta(tsumugi):
  return tsumugi - avg

a_delta = list(map(delta, a))
a_abs = list(np.abs(a_delta))
num_min = np.min(a_abs)
index = a_abs.index(num_min)

print(index)