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

object Main extends App{
    val n = readLine.toInt
    val a = readLine.split(" ")
    var sum = 0
    for (i <- 0 until n) {
        sum = sum + a(i).toInt
    }
    var average = sum / n

    var iAbs = abs(a(0).toInt - average)
    var minAbs = iAbs
    var result = 0
    for (i <- 1 until n) {
        iAbs = abs(a(i).toInt - average)
        if (iAbs < minAbs) {
            result = i
        }
    }
    println(result)
}