fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map{it.toInt()}

    val avg = aa.average()

    var min = 100.0
    var frame = -1

    aa.forEachIndexed { index, a ->
        var diff = Math.abs(a-avg)
        if (diff < min) {
            min = diff
            frame = index
        }
    }

    println(frame)
}