object Main extends App {
  val input = io.Source.stdin.getLines.toIndexedSeq.tail.head.split(' ').map(_.toInt).toSeq
  val avg = input.sum / input.size
  
  val min = input.foldLeft(Int.MaxValue){ (a,e) =>
    val dist = Math.abs(avg - e).toInt
    //println(dist)
    Math.min(a, dist)   
  }
  //println(min)
  val f = input.indexWhere(e => Math.abs(avg - e).toInt == min)
  println(f)
}
