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>
using namespace std;
int main(){
int judge;
int maxscore;
int minscore;
int maxnum;
int minnum;
cin >> judge;
int score[judge];
	for(int i=0; i<=judge; i++){
	cin >> score[i];
		if(score[i] > maxscore){
		maxscore = score[i];
		i=maxnum;
		}
		if(score[i] < minscore){
		minscore = score[i];
		i = minnum;
		}
	}
score[maxnum] = 0;
score[minnum] = 0;
int lastscore = 0;
for(int j=0;j<=judge;j++){
lastscore += score[j];
}
lastscore = lastscore/(judge - 2);
cout << lastscore <<endl;
return 0;
}

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

int main(){
	int n, s, sum, maxs, mins, i;
	while((cin >> n), n){
		sum = maxs = 0;
		mins = 1000;
		for(i = 0; i < n; i++){
			cin >> s;
			sum += s;
			maxs = max(maxs, s);
			mins = min(mins, s);
		}
		cout << (int)(sum / n) << endl;
	}
}

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

using namespace std;

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

C++: #include<iostream>
#include<vector>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
#define INF (1<<29)

int main(){
	int n,s,mi,ma,t;
	while(cin>>n&&n){
		mi=INF;ma=-1;
		s=0;
		for(int i=0;i<n;i++){
			cin>>t;
			s+=t;
			mi=min(mi,t);
			ma=max(ma,t);
		}
		cout<<(s-ma-mi)/(n-2)<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
 
using namespace std;
 
int main(){
    while( true ){
        int n;
        int ma = 0;
        int mi = 0;
        cin >> n;

        if(n == 0){
            break;
        }

        int a[n];

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

        sort(a,a+n);

        for(int i = 2;i < n-1;i++){
            a[1]+=a[i];
        }

        cout << a[1]/(n-2) << endl;
    }   
 
}

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

using namespace std;

int main(){
	vector<int> array;
	int i,x,max,min,sum,n;
	max = 0;
	min = 1000;

	while(cin>>n){
	array.clear();
	sum=0;

	for(i=0;i<sizeof(array);i++){
		cin >> x;
		array.push_back(x);
	}
	for(i=0;i<n;i++){
		if(max<array[i]){
			max= array[i];
		}
	}
	for(i=0;i<n;i++){
		if(min>array[i]){
			min= array[i];
		}
	}
	for(i=0;i<sizeof(array);i++){
		sum += array[i];
	}
	sum = sum-max-min;
	cout << sum/sizeof(array) << endl; 
	}

}

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

int main(){
    int a,n;
    for(;;){
        vector<int> num;
        cin>>n;
        if(n==0) break;
        for(int i = 0; i < n; i++){
            cin>>a;
            num.push_back(a);
        }
        sort(num.begin(), num.end());
        num.erase(num.begin());
         num.pop_back();
        int sum=0;
        for(int x : num){
            sum+=x;
        }
        sum/=num.length();
        cout<<sum<<endl;
    }
    return 0;
}

C++: %:include <cstdio>
%:include <algorithm>
using namespace std;

int main() <%
  for(int tci = 0; ; tci++) <%
    int n; scanf("%d", &n);
    if(n==0) break;
    int minv = 1000, maxv=0, sum=0;
    for(int i = 0; i < n; i++) <%
      int x; scanf("%d", &x);
      minv=min(minv,x);
      maxv=max(maxv,x);
      sum+=x;
    %>
    printf("%d\n", (sum-maxv-minv)/(n-2));
  %>
  return 0;
%>

C++: #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(i = 0; i < n; ++i)

int score[100];
int n, i, k, ans;

int main() {
  for(;;) {
    scanf("%d", &n);
    if(n == 0) break;
    REP(i, n) scanf("%d", &score[i]);
    sort(score, score + n);
    int ans = 0;
    for(int j = 1; j <= n - 2; ++j) ans += score[j];
    printf("%d\n", ans / (n - 2));
  }
  return 0;
}

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

using namespace std;

void find_max(int *data, int N){
  int flag = -1;
  int max = 0;
  for (int i=0; i<N; ++i){
    if (max < data[i]){
      max = data[i];
      flag = i;
    }
  }
  data[flag] = 0;
}

void find_min(int *data, int N){
  int flag = -1;
  int min = 1000000;
  for (int i=0; i<N; ++i){
    if (min > data[i]){
      min = data[i];
      flag = i;
    }
  }
  data[flag] = 0;
}

int main(void){
  int n;
  while (cin >> n){
    if (n == 0){
      return -1;
    }
    
    int *data = new int[n];
    
    for (int i=0; i<n; ++i){
      cin >> data[i];
    }
    find_min(data, n);
    find_max(data, n);
    int sum = 0;
    for (int i=0; i<n; ++i){
      sum += data[i];
    }
    int total = floor((double)sum/(n-2));
    cout << total << endl;
    delete[] data;
  }
  return 0;
}

C++: #include <iostream>

#define el endl
#define fd fixed

using namespace std;

int main() {
  while (1) {
    int n;
    cin >> n;
    int m = n;
    if (n == 0) break;
    int max = INT_MIN;
    int min = INT_MAX;
    int ave = 0;
    while (m--) {
      int x;
      cin >> x;
      ave += x;
      if (x < min) min = x;
      if (x > max) max = x;
    }
    ave = ave - (max + min);
    ave = ave / (n-2);
    cout << ave << el;
  }
}

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

#define ll long long

using namespace std;

int main(void) {
	while (true) {
		ll n;
		cin >> n;
		if (n == 0)break;
		vector<ll> s(n);
		for (int i = 0; i < n; i++) {
			cin >> s[i];
		}
		sort(s.begin(), s.end());
		ll ans = 0;
		for (int i = 1; i < n - 1; i++) {
			ans += s[i];
		}
		ans /= (n - 2);
		cout << ans << endl;
	}
	return 0;
}

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

using namespace std;

int main(){
	int n,one;
	int sum = 0;

	while(cin >> n , n!=0){
		vector<int> v;
		sum = 0;
		
		for (int i = 0; i < n; i++)
		{
			cin >> one;
			v.push_back(one);
		}
		sort(v.begin(),v.end());
		for (int i = 1; i < v.size() -1 ; i++)
		{
			sum += v[i];
		}
		cout << sum/(v.size() - 2) << endl;
	}
}

C++: #include <bits/stdc++.h>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,s,e) for (int i=s;i<(e);i++)
#define All(v) (v).begin(),(v).end()
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define int long long
using namespace std;
typedef long long int64;
typedef pair<int, int> P;
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18 * 5;

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;
    while(n != 0){
        vector<int> s(n);
        REP(i, n) cin >> s[i];
        int sum = accumulate(All(s), 0);
        sum -= *max_element(All(s)) + *min_element(All(s));
        sum /= (n-2);
        cout << sum << "\n";

        cin >> n;
    }
    return 0;
}

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

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