Go: package main

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

var (
	sc = bufio.NewScanner(os.Stdin)
)

func main() {
	for sc.Scan() {
		n, _ := strconv.Atoi(sc.Text())
		scores := make([]int, n, n)
		for i := 0; i < n; i++ {
			sc.Scan()
			scores[i], _ = strconv.Atoi(sc.Text())
		}
		sort.IntSlice(scores).Sort()
		var sum = 0
		for i := 1; i < n-1; i++ {
			sum += scores[i]
		}
		fmt.Println(sum / (n - 2))
	}
}

C++: #include<stdio.h>

void QSort(int x[ ], int left, int right);
void Swap(int x[ ], int i, int j);

void QSort(int x[ ], int left, int right)
{
    int i, j;
    int pivot;

    i = left;                   
    j = right;                  

    pivot = x[(left + right) / 2];
    while (1) {                   

        while (x[i] < pivot)      
            i++;                  

        while (pivot < x[j])      
            j--;                  
        if (i >= j)               
            break;                

        Swap(x, i, j);            
        i++;                      
        j--;
    }

    if (left < i - 1)              
        QSort(x, left, i - 1);     
    if (j + 1 <  right)            
				QSort(x, j + 1, right);    
		}

void Swap(int x[ ], int i, int j)
{
    int temp;

    temp = x[i];
    x[i] = x[j];
    x[j] = temp;
}

int main(void)
{
	int i;
	int j;
	int k;
	int n;
	int d[20];
	int p[100];
	int sum;
	int ave;
	
	while(1){

		scanf("%d",&n);
		if(n==0) 
			break;
			
		j = 0;
		for(i=0;i<n;i++){
		scanf("%d",&p[i]);
		}

		QSort(p,0,n-1);	
	
		sum = 0;
		for(i=1;i<n-1;i++)
			sum += p[i];
	
			
			d[j] = sum / (n-2);
			j++;
	}
	
	for(k=0;k<j;k++)
		printf("%d",d[k]);
	
	return 0;
}

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

int main()
{
	int n;
	while(cin>>n){
		if(n==0) return 0;

		vector<int> V;
		for(int i=0;i<n;i++){
			int t;
			cin>>t;
			V.push_back(t);
		}
		sort(V.begin(),V.end());

		int ans=0;
		for(int i=1;i<V.size()-1;i++)
			ans+=V[i];
		cout<<ans/n<<endl;

	}
}

C++: #include  <stdio.h>

int main(void){

  int size=0;
  int max=0;
  int min=1000;
  int num=0;
  int sum=0;
  while(1){

    min=1000;
    max=0;
    sum=0;
    scanf("%d",&size);
    if(size==0){
      break;
    }
    for(int i=0;i<size;i++){
      scanf("%d",&num);
      sum+=num;
  //    printf("::%d\n",sum);
      if(num<min){
        min=num;
      }
      if(num>max){
        max=num;
      }
    }
//    printf("%d %d",min,max);
    sum=((sum-max)-min)/(size-2);
    printf("%d\n",sum);
}
return 0;
}

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

int main(){
  int a[101];
  int b[20];
  int n = 0;
  int i = 0;
  int max = 0;
  int min = 1000;
  int sum = 0;
  int counter = 0;
  while(1){
    max = 0;
    min = 1000;
    sum = 0;
    cin >> n;
    if(n==0) break;
    for(i=0;i<n;i++){
      cin >> a[i];
      if(max <= a[i]) max = a[i];
      if(min >= a[i]) min = a[i];
      sum += a[i];
    }
    b[counter] = (sum - max - min) / (n - 2);
    counter++;
  }
  for(i=0;i<counter;i++){
    cout << b[i] << endl;
  }
  return 0;
}

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

using namespace std;

int main(){

  while(1){

    int n,sum,ave;
  cin >> n;
  vector<int>vec(n);
  sum=0;
  ave=0;

  if(n==0)break;

  for(int i=0;i<n;i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());

  for(int i=1;i<n-1;i++){
    sum+=vec.at(i);
  }

  ave = sum/(n-2);
  cout << ave <<endl;
  }


}

C++: #include <iostream>
#include<stdio.h>
using namespace std;
int main(void){
    int n;
    int x[21];
    while(1){
        int S=0;
        cin>>n;
        if(n==0){
            break;
        }
        for(int i=0;i<n;i++){
            cin>>x[i];
        }    
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                if(x[i] < x[j]){
                    int temp = x[i];
                    x[i] = x[j];
                    x[j] = temp;
                }
            }
        }
        for(int i=1;i<n-1;i++){
            S=S+x[i];
        }
        int A=0;
        A=S/(n-2);
        cout<<A<<endl;
    }
    return 0;
}

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

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int n;
	while(1){
		cin>>n;
		if(n==0)
		break;
		int x[n],ma=0,mi=0,ans=0;
		for(int i=0;i<n;i++){
			cin>>x[i];
			ans+=x[i];
			if(i==0)
			mi=x[i];
			ma=max(x[i],ma);
			mi=min(x[i],mi);
		}
		cout<<(ans-(ma+mi))/(n-2)<<endl;
	}
return 0;
}

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

using namespace std;
typedef long long ll;

#define LOOP(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) LOOP(i, 0, n)
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359

int main(void) {
  int cnt = 0;
  vector<int> ans;
  while (true) {
    int n;
    cin >> n;
    if (n == 0)
      break;
    vector<int> v;
    int temp;
    for (int i = 0; i < n; i++) {
      cin >> temp;
      v.push_back(temp);
    }
    sort(v.begin(), v.end());
    for(int i=1; i<n-1; i++) {
      cnt += v[i];
    }
    ans.push_back(cnt/(n-2));
    cnt = 0;
  }

  for(int i=0; i<ans.size(); i++) {
    cout << ans[i] << endl;
  }

  return 0;
}

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

int main(){
	int N,n,sum;
	vector<int> point;
	while(1){
		cin>>N;
		if(N==0) break;
		sum=0;

		while(!point.empty()){
			point.pop_back();
		}

		for(int i=0;i<N;i++){
			cin>>n;
			point.push_back(n);
		}

		sort(point.begin(),point.end());

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

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

int main() {
	while (1) {
		int n, maxn, minn;
		int pn = 0;
		cin >> n;
		if ( n == 0 ) break;
		int s[n];
		for (int i = 0; i < n; i++) {
			cin >> s[i];
			if ( i == 0 ) {
				maxn = s[0];
				minn = s[0];
			} else {
				if ( s[i] > maxn ) maxn = s[i];
				if ( s[i] < minn ) minn = s[i];
			}
			pn += s[i];
		}
		cout << (pn - maxn - minn) / (n - 2);
	}
	return 0;
}

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

int main(){
	int n;

	while (cin >> n, n){
		int a[100], sum = 0;
		for (int i = 0; i < n; i++){
			cin >> a[i];
		}
		int sum = accumulate(a, a + n, 0);
		int Max = *max_element(a, a + n);
		int Min = *min_element(a, a + n);
		cout << (sum - (Max + Min)) / (n - 2) << endl;
	}
	return 0;
}

C++: #include<algorithm>
using namespace std; 
int main(){
  int n;  
  while(cin>>n&&n!=0){
    cin>>n;
    int a[]={};
    int sum=0;
    for(int i=0;i<n;i++){    
      int b;
      cin>>b;
      a[i]=b;
      sum+=b;
    }
    sort(a,a+n);
    sum-=a[0];
    sum-=a[n-1];
    cout<<sum/(n-2)<<endl;
  }

  return 0;
}

C++: #include<iostream>
#include<cmath>
#include<vector>
#include<algorithm>
#include<string>
#include<utility>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
  int n;
  while(1){
    cin>>n;
    if(n==0)break;
    int dt[n];
    rep(i,n){
      cin>>dt[i];
    }
    int sum=0;
    sort(dt,dt+n);
    dt[0]=dt[n-1]=0;
    rep(i,n){
      sum+=dt[i];
    }
    cout<<sum/(n-2)<<endl;
  }
  return 0;
}