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 <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n1;
	cin >> n1;
		int a[n1] = { 0 };
		for (int i = 0; i < n1; i++){
			cin >> a[i];
		}
		sort(a, a + n1);
		a[0] = { 0 };
		a[n1 - 1] = { 0 };
		for (int i2 = 1; i2 < n1; i2++){
			a[0] += a[i2];
		}
		cout << a[0] / (n1 - 2) << endl;
return 0;
		
}

C++: #include <iostream>

using namespace std;

int main(){
    int n, max = 0, min = 10000, sum = 0;
    while(cin >> n && n > 0){
        int s[n];
        for (int i = 0; i < n; i++ ){
            cin >> s[i];
            sum += s[i];
        }
        for (int i = 0; i < n; i++){
            if (s[i] > max)
                max = s[i];
        }
        for (int i = 0; i < n; i++){
            if (s[i] < min)
                min = s[i];
        }
        cout << (sum - max - min)/(n - 2) << endl;
    }
}

C++: #include <iostream>

int main()
{
    int judgeNum;
    int maxPoint = 0;
    int minimumPoint = 0;
    int pointSum = 0;

    std::cin >> judgeNum;

    int point[judgeNum];

    for(int i = 0; i < judgeNum; i++) {
        std::cin >> point[i];
        if(point[i] > maxPoint) {
            maxPoint = point[i];
        } else if (point[i] < minimumPoint) {
            minimumPoint = point[i];
        }
        pointSum += point[i];
    }

    std::cout << (pointSum - maxPoint - minimumPoint) / (judgeNum - 2) << std::endl;

    return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(void){
  int n, ma, mi, sum, k;
  while(cin >> n, n){
    sum = ma = 0; mi = 9999;
    for(int i = 0;i < n; i++){
      cin >> k;
      sum += k;
      ma = max(ma, k); mi = min(mi, k);
    }
    sum = sum - ma - mi;
    cout << sum / (n - 2) << endl;
  }
}

C++: #include<iostream>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>

using namespace std;

#define INF 999999999

int main(){
	int n, s[100], k;
	double l, g, sum;
	double ans;
	while(1){
		cin >> n;
		if(!n) break;
		g = -1;
		l = 1001;
		sum = 0;
		for(k=0;k<n;k++){
			cin >> s[k];
			sum += s[k];
			if(g < s[k]) g = s[k];
			if(l > s[k]) l = s[k];
			//cout << g << " " << l << " " << sum << endl;
		}
		ans = (sum - l - g)/((double)n-2);
		cout << (int)ans << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
    while(1){
        int N;
        cin >> N;
        if(N==0) break;
        vector<int> A(N,0);
        for(int i=0;i<N;i++){
            cin >> A[i];
        }
        int M=0;
        int m=1000;
        int sum=0;
        for(int i=0;i<N;i++){
            sum+=A[i];
            if(M<A[i]){M=A[i];}
            if(m>A[i]){m=A[i];}
        }
        cout << (sum-M-m)/(N-2) << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
 
cin>>n;
vector<int> v(n);
int sum=0;
 for(int i=0;i<n;++i){
cin>>v[i];
}
sort(begin(v),end(v));
for(int i=1;i<n-1;++i){
sum+=v[i];}
cout<<sum/(n-2)<<endl;
}

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

using namespace std;

int main(){
	for(int n;scanf("%d",&n),n;){
		int sum=0,mx=-1,mn=1001;
		for(int i=0;i<n;i++){
			int a;	scanf("%d",&a);
			sum+=a;
			mx=max(mx,a);
			mn=min(mn,a);
		}
		printf("%d\n",(sum-mx-mn)/(n-2));
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int n;
long int ans;
int main() {
  for(;;) {
    scanf("%d", &n);
    if(n == 0) break;
    vector<int> v(n);
    for(int i = 0; i < n; ++i) scanf("%d", &v[i]);
    sort(begin(v), end(v));
    v[n - 1] = 0, v[0] = 0;
    for(int i = 0; i < n; ++i) ans+=v[i];
    ans /= n - 2;
    printf("%ld\n", ans);
    n = 0, ans = 0;
    v.clear();
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
  int n;
  while(cin>>n,n){
    vector<int>in(n);
    for(int i=0;i<n;i++)cin>>in[i];
    sort(in.begin(),in.end());
    int sum=0;
    for(int i=1;i<n-1;i++)sum+=in[i];
    cout<<sum/(n-2)<<endl;
  }
}

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

using namespace std;

#define rep(i,n) for(int i=0;i<n;++i)
#define Rep(i,n) for(int i=1;i<=n;++i)
#define rrep(i,n) for(int i=n-1;0<=i;--i)
#define rRep(i,n) for(int i=n;0<i;--i)
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define scani(a) scanf("%d",&a)
#define scanr(a) scanf("%lf",&a)
#define scans(s) scanf("%s",s)
#define printi(a) printf("%d",a)
#define printr(a) printf("%lf",a)
#define prints(s) printf("%s",s)
#define is_odd(n) (n&1)
#define is_even(n) ((n+1)&1)
#define mp make_pair
#define pb push_back
#define fst first
#define snd second
#define all(x) x.begin(), x.end()
#define EPS 1e-8
#define INF 1e8
#define PI acos(-1.0)

typedef double Real;
typedef int Int;
typedef vector<Int> vi;
typedef vector<vector<Int> > vvi;
typedef pair<Int,Int> pii;

inline Real sr(Real a) {return sqrt(max(a, (Real)0));}
template <typename T> inline T sq(T a) {return a * a;}
const vi dy = {-1, 0, 1, 0}, dx = {0, -1, 0, 1};
vector<string> split(const string &s, char d) {vector<string> r;stringstream t(s);string x;while(getline(t,x,d))if(!x.empty())r.push_back(x);return r;}


void solve()
{
  for(;;)
  {
    Int N; scani(N);
    if(N == 0) break;

    vi s;
    s.resize(N);
    rep(i, N) scani(s[i]);

    sort(all(s));

    cout << accumulate(s.begin()+1, s.end()-1, 0) / (s.size()-2) << endl;
  }
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(9);

  solve();

  return 0;
}

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

int main() {
    int n;
    while (cin >> n, n) {
        vector<int> s(n);
        for (int i = 0; i < n; ++i) cin >> s[i];
        sort(s.begin(), s.end());

        int sum = 0;
        for (int i=1; i<n-1; ++i) {
            sum += s[i];
        }
        cout << sum / (n - 2) << endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <algorithm>
#include <deque>

using namespace std;

int main(){
	while( 1 ){
		int sum = 0;
		int n, s;
		deque< int > scores;
		scanf( "%d", &n );
		if( !n ){ return 0; }
		for( int i = 0; i < n; i++ ){
			scanf( "%d", &s );
			scores.push_back( s );
		}
		sort( scores.begin(), scores.end() );
		for(deque<int>::iterator it = scores.begin() + 1; it + 1 != scores.end(); it++){
			sum += *it;
		}
		
		printf( "%d\n", sum / ( n - 2 ) );
	}
}

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

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

    while( cin >> n )
    {
        if( n == 0 )
            break;
        for( int i = 0; i < n; i++ )
            cin >> a[i];

        int min = 10000000, max = -1, sum = 0;
        for( int i = 0; i < n; i++ )
        {
            if( min > a[i] )
                min = a[i];
            if( max < a[i] )
                max = a[i];
            sum += a[i];
        }
        cout << ( sum - min - max ) / ( n - 2 ) << endl;
    }
    return 0;
}