Go: // ICPC 得点集計ソフトウェア
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1147&lang=jp
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	for	{
		n := nextInt(sc)
		if n == 0 { break }

		score_list := []int{}
		for i := 0; i < n; i++ {
			score_list = append(score_list, nextInt(sc))
		}

		// 最低点と最高点を取り除く (3 ≤ n ≤ 100)
		sort.Sort(sort.IntSlice(score_list))
		score_list = score_list[1:len(score_list)-1]

		// 平均点を求める
		sum := 0
		for _, score := range score_list {
			sum += score
		}
		fmt.Println(sum / len(score_list))
	}
}

func nextInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return i
}

C++:                                                                                                                                                                                                                                                     #include <iostream>
                                                                                                                                                                                                                                                    using namespace std;
                                                                                                                                                                                                                                                    int main() {
                                                                                                                                                                                                                                                        int n, s;
                                                                                                                                                                                                                                                        while (cin >> n && n) {
                                                                                                                                                                                                                                                            int mx = -1;
                                                                                                                                                                                                                                                            int mn = 1001;
                                                                                                                                                                                                                                                            int sum = 0;
                                                                                                                                                                                                                                                            for (int i=0; i<n; ++i) {
                                                                                                                                                                                                                                                                cin >> s;
                                                                                                                                                                                                                                                                sum += s;
                                                                                                                                                                                                                                                                mx = max(mx, s);
                                                                                                                                                                                                                                                                mn = min(mn, s);
                                                                                                                                                                                                                                                            }
                                                                                                                                                                                                                                                            sum = sum - mx - mn;
                                                                                                                                                                                                                                                            cout << sum / (n - 2) << endl;
                                                                                                                                                                                                                                                        }
                                                                                                                                                                                                                                                        return 0;
                                                                                                                                                                                                                                                    }