import java.util.*

class A

fun main( args: Array<String> ) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val a = IntArray( n, { sc.nextInt() } )
    val sum = a.sum()
    var minDiff = Int.MAX_VALUE
    var bestIdx = -1
    for ( i in a.indices ) {
        val diff = Math.abs(a[i] * n - sum)
        if ( diff < minDiff ) {
            minDiff = diff
            bestIdx = i
        }
    }
    println( bestIdx )
}