Go: package main

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

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

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

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

		score_list := []int{}
		for i := 0; i < num; 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))
	}
}

C++: 
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(int argc, char const *argv[])
{
	VI ret;
	int n;
	while(true){
		cin >> n;
		if(n == 0) break;
		VI a(n);
		REP(i, n)
			cin >> a[i];
		SORT(a);
		a.erase(a.begin());
		a.pop_back();
		int size = a.size();
		int sum = 0, ave = 0;
		REP(i, size)
			sum += a[i];
		ave = sum / size;
		ret.PB(ave);
	}

	REP(j, ret.size())
		cout << ret[j] << endl;

	return 0;
}

C++: #include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))

using namespace std;

using i32 = int;
using i64 = long long;
using u64 = unsigned long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vu64 = vector<u64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
inline u64 xorshift() { static u64 x = 88172645463325252ull; x = x ^ (x << 7); return x = x ^ (x >> 9); }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n, T e = 1) { T r = e; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { each(x, v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }
template <typename T, typename S> istream& operator>>(istream &is, pair<T, S> &p) { is >> p.first >> p.second; return is; }
template <typename T, typename S> ostream& operator<<(ostream &os, pair<T, S> &p) { os << p.first << ' ' << p.second; return os; }

void solve() {
  while (true) {
    int n; cin >> n;
    if (n == 0) break;
    vi32 a(n); cin >> a;
    sort(all(a));
    int sum = 0;
    for (int i = 1; i < n - 1; i++) sum += a[i];
    cout << sum / (n - 2) << '\n';
  }
}

C++: #include <iostream>
using namespace std;
int main() {
    int a,b;
    
    while(cin >> a && a>0) {
    
        int max = 0;
        int min = 1000;
        int sum = 0;
        
        
        for (int i = 0; i < a; ++i) {
            cin >> b;
            sum += b;
            
            if (b > max) max = b;
            if (b < min) min = b;
        }
        
        int avg = (sum - max - min) / (a-2);
        
        cout << avg << endl;
        
    }
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int main() {
	int n, point[100];

	while (cin >> n && n != 0) {
		for (int i = 0; i < n; i++) {
			cin >> point[i];
		}
		sort(&point[0], &point[n]);

		int sum = 0;
		for (int i = 1; i < n - 1; i++) {
			sum += point[i];
		}
		cout << sum / (n - 2) << '\n';
	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){

 
  while(1){
    int score = 0, n, max = INT_MIN, min = INT_MAX, ava = 0, cnt = 0;

    cin >> n;
    if(n == 0) break;

    for(int i = 0; i < n; i++){
      cin >> score;
      ava += score;
      if(score > max) max = score;
      if(score < min) min = score;
  }
    cout << (ava - max - min) / (n - 2) << endl;
  }

  return 0;
}

C++: #include <iostream>
using namespace std;

int main()
{
	int n, s[100], i, max = 0, min = 1000, ave = 0;
	while(1)
	{
		cin >> n;
		if(n == 0){
			break;
		}
		for(i = 0; i < n; i++)
		{
			cin >> s[i];
			if(max < s[i]){
				max = s[i];
			}
			if(min > s[i]){
				min = s[i];
			}
		}
		
		for(i = 0; i < n; i++)
		{
			ave += s[i];
		}
		ave -= (max + min);
		ave /= (n - 2);
		
		cout << ave << endl;
		max = 0;
		min = 1000;
		ave = 0;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>

using namespace std;

int main(){
	int n;
	int a[100];
	while(cin >> n,n){
		for (int i = 0; i < n; ++i) cin >> a[i];
		sort(a,a+n);
		int sum = 0;
		for (int k = 1; k < n-1; ++k) sum += a[k];
		cout << (sum / n-2) << endl;	
	}
	return 0;
}