fun main(args: Array<String>) {
    val n = readInteger()
    val aList = readIntegerList()
    val ave = aList.average()
    var minDeviation = Math.abs(ave - aList.first())
    var minIndex = 0
    for (i in 1 until n) {
        val deviation = Math.abs(ave - aList[i])
        if (deviation < minDeviation) {
            minDeviation = deviation
            minIndex = i
        }
    }
    println(minIndex)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
