
fun main(args:Array<String>) {
    val n = readLine()!!.toInt()
    val flames = readLine()!!.split(" ").map { it.toInt() }
    val avg = flames.average()
    val min = flames.map { Math.abs(it-avg) }.min()!!
    val ans = flames.indices.filter { Math.abs(flames[it]-avg) == min }.first()
    println(ans)
}
