'use strict'



function Main(input) {

  input = input.trim().split('\n')
  const N = parseInt(input[0])
  const a = input[1].split(' ').map(s => parseInt(s))
  const res = a.reduce((a, b) => a + b) / a.length

  let min = 0
  let diff = 9999
  for(let i = 0; i < N; ++i) {
    if(res === a[i])  {
      min = i
      break
    }
    
    let tmp = Math.abs(res - a[i])

    if (diff > tmp) {
      diff = tmp
      min = i
    }

  }

  console.log(min)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
