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
}

Python: # coding=utf-8

###
### for atcorder program
###

import sys
import math
import array

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]
#R = float(input())
#A = [int(x) for x in input().split()]
#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def main():
    ans = []
    while(True):
        N = int(input())
        point = []

        if N == 0:
            break

        for i in range(N):
            point.append(int(input()))
    
        pointsum = sum(point)-(max(point)+min(point))

        ans.append(pointsum//(N-2))
        
    for i in ans:
        print(i)

if __name__ == '__main__':
    main()

Python: import sys
F = sys.stdin
Continue = True
while Continue:
    N = int(F.readline().strip("\n"))
    if N == 0:
        Continue = False
        break
    else:
        Score = [None] * N
        for i in range(N):
            Score[i] = int(F.readline().strip("\n"))
        Score.sort()
        print(sum(Score[1:N-1])//(N-2))

Python: while True:
    n = int(input())
    if n == 0: break
    a = []
    for i in range(n):
        a.append(int(input()))
    print((sum(a)-max(a)-min(a))//(len(a)-2))

Python: while True:
    #審判の数
    n = int(input())
    if n == 0:
        break
    while n >= 3 and n <= 100: #審判の数は３〜１００人
        a = [0]*n               #空いてる配列
        for i in range(n):       #空いてる配列に点数を入れる
            s = int(input())
            a[i] = s
        tensu = (sum(a) - min(a) -max(a))/(len(a)-2) #一番でかい点数と一番小さい点数は一つずつ引いて平均
        print(int(tensu))        #平均点！

Python: while 1:
    n=int(input())
    if n==0:break
    print((sum(sorted([int(input()) for _ in range(n)])[1:-1]))//(n-2))

Python: trial = int(input())
while True:
    targ = []
    for t in range(trial):
        targ.append(int(input()))
    targ.remove(max(targ))
    targ.remove(min(targ))
    print(sum(targ) // len(targ))
    trial = int(input())
    if trial ==0:
        break

Python: import math

def main():
    f = true
    r = []
    while f:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m)/(n-2))))
    res = ''
    for j in r:
        res += str(j)
    print(j)

Python: while True:
	n = int(input())
	if n == 0:
	    break
	data=[]
	for i in range(n):
	    a=int(input())
	    data.append(a)
	print((sum(data)-max(data)-min(data))//(n-2))

Python: def main():
	while True:
		n=int(input())
		if n==0:
			break
		ls=[int(input()) for i in range(n)]
		ls.sort()
		score_sum=sum(ls)-ls[0]-ls[n-1]
		print(int(score_sum//(n-2)))

if __name__=="__main__":
	main()

Python: while True:
    n = int(input())
    if n == 0:
        break

    nums = [int(input()) for _ in range(n)]
    max_num = max(nums)
    min_num = min(nums)
    nums.remove(max_num)
    nums.remove(min_num)
    print(sum(nums) // len(nums))

Python: while True:
  n = int(input())
  if n == 0:
    break
  print(sum(sorted([int(input()) for _ in range(n)])[1:-1]) // (n - 2))

Python: while True:
  n = int(input())
  if n == 0:
    break
  a = [int(input()) for i in range(n)]
  print((sum(a)-min(a)-max(a))//(n-2))

Python: while True:
    n=int(input())
    points=[]
    for i in range(n):
        points.append(int(input()))
    points.remove(max(points))
    points.remove(min(points))
    print(int(sum(points)/len(points)))
    if int(input())==0:break

Python: while True:
  n = int(input())
  if n ==0:
    break
  else:
    list1=[0]*n
    for i in range(n):
      list1[i]=int(input())
    print( (sum(list1)-max(list1)-min(list1))//(len(list1)-2) )

Python: while True:
    n=int(input())
    if n == 0: break
    a=[]
    for i in range(n):
        a.append(int(input()))
    print((sum(a)-max(a)-min(a))//(len(a)-2))

Python: from statistics import mean
while True:
  N = int(input())
  if N == 0:
    break
  S = []
  for i in range(N):
    S.append(int(input()))
  S.remove(max(S))
  S.remove(min(S))
  print(int(mean(S)))

Python: while True:
    N = int(input())
    if N == 0:
        break
    S = []
    for i in range(N):
        S.append(int(input()))
    print((sum(S)-max(S)-min(S))//(N-2))

Python: while True:
    n=int(input())
    if n==0:
        break
    s=[int(input()) for i in range(n)]
    a=max(s)
    b=min(s)
    c=sum(s)
    d=(c-a-b)//(n-2)
    print(d)

Python: import math

def main():
    r = []
    while True:
        n = int(input())
        if n == 0:
            break
        m = []
        for i in range(n):
            m.append(int(input()))
        r.append(math.floor((sum(m) - max(m) - min(m)/(n-2))))
    res = ''
    for j in r:
        res += str(j)
    print(res)

main()

Python: n=int(input())
while n!=0:
    total=0
    saidai=None
    saishou=None
    for i in range(n):
        s=int(input())
        total+=s
        if saidai is None or s>saidai:
            saidai=s
        if saishou is None or s<saishou:
            saishou=s
    print((total-saidai-saishou)//(n-2))        
    n=int(input())

Python: from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

while True:
    n = inp()
    if n == 0:
        break
    else:
        aa = [inp() for i in range(n)]
        aa.sort()
        print(sum(aa[1:n-1])//(n-2))