# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1147&lang=jp

while true
  n = gets.to_i

  break if n == 0

  arr = n.times.map{ gets.to_i }

  puts (arr.reduce(:+) - arr.max - arr.min) / (n-2)
end