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 <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef vector<int>    VI;
typedef vector<bool>   VB;
typedef vector<string> VS;

#define MP make_pair
#define PB push_back
#define ALL(x)  (x).begin(),(x).end()
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

int n;
VI ss;

int main(void) {
	while (1) {
		ss.clear();
		cin >> n;
		if (n == 0) break;
		rep (i, n) {
			int s;
			cin >> s;
			ss.PB(s);
		}
		sort(ALL(ss));
		int sum = 0;
		REP (i, 1, ss.size() - 1) {
			sum += ss[i];
		}
		cout << sum / (n - 2) << endl;
	}
    return 0;
}

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

using namespace std;
int main(){
  int n;
  int s[111];
  while(cin>>n){
    if(n ==0)
      break;
    for(int i = 0;i<n;i++){
      cin>>s[i];
    }
    sort(s,s+n);
    int ans = 0;
    for(int i = 1;i<n-1;i++)
      ans += s[i];

    ans /= n-2;
    cout<<ans<<endl;
  }
  return 0;


}

C++: #include<iostream>

using namespace std;

int main(){
  int n,i,p,max,min,s;

    while(1){
      cin>> n;
      if(n){}else()break;
      
      cin>> p;
      s = p;
      max = p;
      min = p;

      for(i = 0 ; i < n-1 ;i++){
          cin>> p;
          pre += p;
          if(max < p){
              max = p;
	  }
          if(min > p){
              min = p;
	  }
      }
      p = (p - max - min)/ (n-2);
      cout>> p >> endl;
  }    
  return 0;
}

C++: #include <iostream>
using namespace std;
int N, S;
int main()
{
  while (cin >> N && N > 0){
    if (N<3 || N>100)
      exit (1);
    int sum = 0;
    int largest = 0;
    int smallest =1000;   
 for (int i=0; i<N; ++i){
      cin >> S;
      if (S<0 || S>1000)
        exit (2);
      sum += S;
      if (largest < S)
        largest=S;
      if (smallest > S)
        smallest=S;
    }
    int average = 0;
    average = (sum - largest - smallest) / (N - 2);
    cout << "Average:";
    cout << average << endl;
  }
}

C++: #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
template<class T> using vv=vector<vector<T> >;

int main() {
  vector<int> results;

  while (true) {
    int count;
    cin >> count;
    if (count == 0) { break; }
    vi point(count);
    for (int i = 0 ; i < count ; i++) {
      cin >> point[i];
    }
    //sort(point.begin(), point.end());
    int max_point = -1;
    int min_point = 1001;
    int ave = 0;
    for (int i = 0 ; i <= point.size()-1 ; i++) {
      ave += point[i];
      if (max_point < point[i]) {
        max_point = point[i];
      }
      if (min_point > point[i]) {
        min_point = point[i];
      }
    }
    ave -= (max_point + min_point);
    ave /= (count-2);
    results.push_back(ave);
  }

  for (int i = 0 ; i < results.size() ; i++) {
    printf("%d\n", results[i]);
  }

  return 0;
}

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

int main(){
int n;
while(cin>>n){

if(n==0){break;}
int s[10000];
int al=0;
int mx=0;
int mi=10000;

for(int i=0;i<n;i++){
cin>>s[i];
al+=s[i];
mx=max(mx,s[i]);
mi=min(mi,s[i]);
}

al=(al-mx-mi)/(n-2);
cout<<al<<endl;
}



return 0;
}

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

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

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

using namespace std;

int main(){
	int size;
	while(true){
		cin >> size;
		if(size == 0){
			break;
		}
		int maxv=-1;
		int minv = 100000000;
		int sum = 0;
		for(int i=0;i<size;i++){
			int num;
			cin >> num;
			sum += num;
			minv = min(minv,num);
			maxv = max(maxv,num);
		}
		int result = (sum-minv-maxv)/(size-2);
		cout << result << endl;
	}
	return 0;
}