import scala.io.StdIn.readInt
import scala.collection.mutable.ArrayBuffer

object Main {
  def main(args:Array[String]) = {
    val b = new ArrayBuffer[Int]
    var n = 0
    while({n=readInt;n} != 0) {
      val m = { for(i<-1 to n) yield readInt }.sorted.dropRight(1).drop(1)
      b += m.sum/m.length
    }
    println(b.mkString("\n"))
  }

}