fun main(args: Array<String>) {
    val N = readLine()!!.toInt()
    val a = readLine()!!.split(" ").mapIndexed { index, s -> Pair(index, s.toInt()) }
    val average = a.sumBy { it.second } / N
    println(a.sortedBy { Math.abs(it.second - average) + 1 }.first().first)
}