import scala.io.StdIn

object Main extends App {
  val n = StdIn.readLine.toInt
  val a = StdIn.readLine.split(" ").map(_.toInt)

  val ave = (a.sum / a.size)

  var ans = 0
  var cnt = 0
  var min = 100000000.0
  for(e <- a) {
    val d = math.abs(e - ave)
    if(min > d) {
      min = d
      ans = cnt
    }
    cnt += 1
  }

  println(ans)
}