fun main(args: Array<String>){
	readLine()!!
	val a = readLine()!!.split(" ").map { it.toInt() } // Array

  var ave = a.average()

	// println(ave)

  var minDiff = 9999.0
  var ans = -1
  for ((i, v) in a.withIndex()) {
    val diff = Math.abs(v - ave)
    if ( diff < minDiff) {
      minDiff = diff
      ans = i
    }
  }

	println(ans)
}