import scala.io.StdIn._
import scala.math._

object Main {
  def main(args: Array[String]): Unit = {
    val n = readLine.toInt
    val a = readLine.split(" ").map(_.toInt)
    println(solve(n, a))
  }

  def solve(n: Int, a: Array[Int]): Int = {
    val s: Double = a.sum
    val h = s / n
    var index: Int = -1
    var min: Double = 100000000
    for {
      i <- 0 to n-1
    } {
      if(abs(a(i) - h) < min){
        index = i
        min = abs(a(i) - h)
      }
    }
    index
  }
}
