
object Main extends App {

  import scala.io.StdIn._


  val n = readLine.trim.toInt
  val frames = readLine.trim.split(' ').map(_.toInt)
  val sum = frames.sum
  var sam = 0
  for ((frame, idx) ← frames.zipWithIndex){
      if (math.abs(frames(sam) * n - sum) > math.abs(frame * n - sum)){
        sam = idx
      }
  }
  println(
    sam
  )

  implicit class Extenion[T](val value :T){
    def also(func: T ⇒ Unit): T = {
      func(value)
      value
    }
    def let[R](func: T ⇒ R): R = func(value)
  }
}