object Main {
    def main(args : Array[String]) : Unit = {
        solve()
    }

    def solve() : Unit = {
        val sc = new java.util.Scanner(System.in)
        var N = sc.nextInt
        var A = List.fill(N)(sc.nextInt)
        thumbnail(A,N)
    }

    def getAvarage(A : List[Int], N : Int) : Double = {
        return A.sum.toDouble / N
    }

    def thumbnail(A : List[Int], N: Int) : Unit = {
        var avg = getAvarage(A, N)
        var dif = (0 until N).map(i => (A(i) - avg).abs)
        println(dif.indexOf(dif.min))
    } 
}