output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      a_{0} a_{1} ... a_{N-1}
attempt: from heapq import heappush, heappop, heapify
  from collections import deque, defaultdict, Counter
  import itertools
  from itertools import permutations, combinations, groupby
  import sys
  import bisect
  import string
  import math
  import time
  import random
  
  
  def S_():
      return input()
  
  
  def LS():
      return [i for i in input().split()]
  
  
  def I():
      return int(input())
  
  
  def MI():
      return map(int, input().split())
  
  
  def LI():
      return [int(i) for i in input().split()]
  
  
  def LI_():
      return [int(i) - 1 for i in input().split()]
  
  
  def NI(n):
      return [int(input()) for i in range(n)]
  
  
  def NI_(n):
      return [int(input()) - 1 for i in range(n)]
  
  
  def StoI():
      return [ord(i) - 97 for i in input()]
  
  
  def ItoS(nn):
      return chr(nn + 97)
  
  
  def LtoS(ls):
      return "".join([chr(i + 97) for i in ls])
  
  
  def GI(V, E, Directed=False, index=0):
      org_inp = []
      g = [[] for i in range(n)]
      for i in range(E):
          inp = LI()
          org_inp.append(inp)
          if index == 0:
              inp[0] -= 1
              inp[1] -= 1
          if len(inp) == 2:
              a, b = inp
              g[a].append(b)
              if not Directed:
                  g[b].append(a)
          elif len(inp) == 3:
              a, b, c = inp
              aa = (inp[0], inp[2])
              bb = (inp[1], inp[2])
              g[a].append(bb)
              if not Directed:
                  g[b].append(aa)
      return g, org_inp
  
  
  def bit_combination(k, n=2):
      rt = []
      for tb in range(n**k):
          s = [tb // (n**bt) % n for bt in range(k)]
          rt += [s]
      return rt
  
  
  def show(*inp, end="\n"):
      if show_flg:
          print(*inp, end=end)
  
  
  YN = ["Yes", "No"]
  mo = 10**9 + 7
  inf = float("inf")
  l_alp = string.ascii_lowercase
  u_alp = string.ascii_uppercase
  ts = time.time()
  # sys.setrecursionlimit(10**5)
  input = lambda: sys.stdin.readline().rstrip()
  import fractions
  
  
  # gcd=fractions.gcd
  def ran_input():
      import random
  
      n = random.randint(4, 16)
      rmin, rmax = 1, 10
      a = [random.randint(rmin, rmax) for _ in range(n)]
      return n, a
  
  
  class Comb:
      def __init__(self, n, mo=10**9 + 7):
          self.fac = [0] * (n + 1)
          self.inv = [1] * (n + 1)
          self.fac[0] = 1
          self.fact(n)
          for i in range(1, n + 1):
              self.fac[i] = i * self.fac[i - 1] % mo
              self.inv[n] *= i
              self.inv[n] %= mo
          self.inv[n] = pow(self.inv[n], mo - 2, mo)
          for i in range(1, n):
              self.inv[n - i] = self.inv[n - i + 1] * (n - i + 1) % mo
          return
  
      def fact(self, n):
          return self.fac[n]
  
      def invf(self, n):
          return self.inv[n]
  
      def comb(self, x, y):
          if y < 0 or y > x:
              return 0
          return self.fac[x] * self.inv[x - y] * self.inv[y] % mo
  
  
  show_flg = False
  show_flg = True
  
  
  def gcd(x, y):
      while y != 0:
          x, y = y, x % y
      return x
  
  
  ans = 0
  
  n = I()
  a = LI()
  
  av = sum(a) / n
  m = min([abs(i - av) for i in a])
  for i in range(n):
      if m == abs(a[i] - av):
          print(i)
          exit()
  
  # print(ans)
  
problem_description: Statement
  
  Niwango-kun is an employee of Dwango Co., Ltd.  
  One day, he is asked to generate a thumbnail from a video a user submitted.  
  To generate a thumbnail, he needs to select a frame of the video according to
  the following procedure:
  
    * Get an integer N and N integers a_0, a_1, ..., a_{N-1} as inputs. N denotes the number of the frames of the video, and each a_i denotes the representation of the i-th frame of the video.
    * Select t-th frame whose representation a_t is nearest to the average of all frame representations.
    * If there are multiple such frames, select the frame with the smallest index.
  
  Find the index t of the frame he should select to generate a thumbnail.
samples: [{"input": "3\n    1 2 3", "output": "1\n    \n\nSince the average of frame representations is 2, Niwango-kun needs to select\nthe index 1, whose representation is 2, that is, the nearest value to the\naverage.\n\n* * *"}, {"input": "4\n    2 5 2 5", "output": "0\n    \n\nThe average of frame representations is 3.5.  \nIn this case, every frame has the same distance from its representation to the\naverage.  \nTherefore, Niwango-kun should select index 0, the smallest index among them."}]