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))
	}
}

Python: while True:
    mylist = []
    n = input()
    n = int(n)
    if n ==0:
        break
    for i in range(0,n):
        mylist.append(int(input()))
    mylistz = sorted(mylist)
    del mylistz[0]
    del mylistz[n-2]
    print(int(sum(mylistz))//(n-2))

Python: while True:
    n = int(input())
    max = 0
    min = 1000
    sum = 0
    ave = 0
    if n == 0:
        break
    for i in range(n):
        s = int(input())
        sum += s
        if s < min:
            min = s
        if max < s:
            max = s
    ave = (sum - min - max) // (n - 2)
    print(ave)

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

    S = []
    for i in range(n):
        S.append(int(input()))

    S.sort()
    S = S[1:n-1]

    print(sum(S) // len(S))

Python: def solve(n, score):
    score = sorted(score)
    return sum(score[1:-1])//len(score[1:-1])

def main():
    ans = []
    while True:
        n = int(input())
        if (n == 0):
            break
        score = [int(input()) for i in range(n)]
        ans.append(solve(n, score))
    
    for i in ans:
        print(i)

main()

Python: result = []
while True:
    no_referee = int(input())
    if no_referee == 0:
        break
    else:
        sum_score = 0
        max_score = 0
        min_score = 1000
        for i in range(no_referee):
            score = int(input())
            sum_score += score
            if score > max_score:
                max_score = score
            if score < min_score:
                min_score = score
        sum_score = sum_score - max_score - min_score
        result.append(int(sum_score/(no_referee-2)))

for r in result:
    print(str(r))

Python: import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**3
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    rr = []
    while True:
        n = I()
        if n == 0:
            break
        a = sorted([I() for _ in range(n)])
        r = sum(a[1:-1]) // (n-2)
        rr.append(r)

    return '\n'.join(map(str, rr))


print(main())

Python: while True:
    n=int(input())
    list=[]
    if n==0:
        break
    for i in range(n):
        list.append(int(input()))
    list.sort()
   
    ave=(sum(list)-list[0]-list[-1])//(n-2)
    print(ave)

Python: while True:
	n = int(input())
	if n == 0: break
	s, vmin, vmax = 0, 1001, -1
	for i in range(n):
		a = int(input())
		vmin = min(vmin, a)
		vmax = max(vmax, a)
		s += a
	print((s-vmin-vmax)//(n-2))

Python: import math
while True:
    n = int(input())
    scores = [int(input()) for i in range(n)]
    scores.sort()
    
    if n == 0:
        break
    total = 0
    
    for i in range(1, n - 1):
        total += scores[i]
        
    print(math.floor(total / (n - 2)))

Python: import sys

while True:
    n = int(input())
    if n == 0:
        break
    print( int( sum( sorted( [int(input()) for x in range(0, n)] )[1:-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))
    
    if n==0:break

Python: def average(points):
    sum = 0
    for i in points:
        sum += i
    return sum / len(points)

outputs = []

while True:
    num = int(input())
    if num == 0:
        break

    points = []
    for _ in range(num):
        point = int(input())
        points.append(point)

    points = sorted(points)
    points = points[1:len(points)-1]

    ave = average(points)
    outputs.append(int(ave))

for ave in outputs:
    print(ave)

Python: N=int(input())
while N!=0:
    data=[]
    for i in range(N):
        data.append(int(input()))
    data.sort()
    Sum=0
    Count=0
    for i in range(N-2):
        Sum+=data[i+1]
        Count+=1
    print(Sum//Count)
    N=int(input())

Python: while True :
    
    n=int(input())
    if n==0 :
        break
    
    i=0
    b=0
    ma=0
    mi=1000
    while i<n :
        c=int(input())
        if ma<c :
            ma=c
        if mi>c :
            mi=c
        b=b+c
        i=i+1
    print(int((b-ma-mi)/(n-2)))

Python: # coding: utf-8
# Here your code !
fin = False
while fin == False:
    lists = []
    times = int(input())
    if times == 0:
        fin == True
        break
    else:
        for i in range(times):
            a = int(input())
            lists.append(a)
        lists.remove(max(lists))
        lists.remove(min(lists))
        s = 0
        for i in lists:
            s+=i
        result = int(s/len(lists))
        print(result)

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

Python: while True:
    n=int(input())
    if n == 0:
        break
    else:
        li1=[0]*n
    
        #t=1
        for t in range(n):  
            li1[t]=int(input())
        s=int((sum(li1)-max(li1)-min(li1))/(n-2))
        print(s)

Python: # coding: utf-8
# Your code here!

while True:
   min = 1000
   max = 0
   sum = 0
   
   n = int(input())
   if n == 0:
      break
   for i in range(n):
      s = int(input())
      if s < min:
         min = s
      if s > max:
         max = s
      sum += s
   print((sum - min - max) // (n - 2) )

Python: import sys
import math
input = sys.stdin.readline
##

num_score = int(input().rstrip())
while num_score != 0:
    scores = []
    for _ in range(num_score):
        scores.append(int(input().rstrip()))
    total = sum(scores) - max(scores) - min(scores)
    average = math.floor(total / (len(scores) - 2))
    print(average)
    num_score = int(input().rstrip())

Python: # 演習１－１２
while True:
    a = int(input())
    if a == 0:
        break
    else:
        li = [0]*a
        for i in range(a):
            li[i] = int(input())
        li_sort = sorted(li)
        del li_sort[0]
        del li_sort[-1]
        print(int(sum(li_sort)/len(li_sort)))

Python: while True:
        a = int(input())
        if a == 0:
                break
         
        b = [int(input()) for i in range(a)]
        b.sort()
        bmin = min(b)
        bmax = max(b)
        bsum = sum(b)
        print((bsum-bmin-bmax)//(a-2))

Python: while True:
    n=int(input())
    if n==0:
        break
    i=1
    sum=0
    max=0
    min=1000
    while i<=n:
        a=int(input())
        if max<a:
            max=a
        if min>a:
            min=a
        sum+=a
        
        
        i+=1
    sum=sum-max-min
    print(int(sum/(n-2)))

Python: while True:
    n = int(input())
    max = 0
    min = 1000
    sum = 0
    if n == 0:
       break
    for i in range(n):

        s = int(input())
        sum += s
        if s < min:
            min = s
        if max < s:
            max = s
    ave = (sum - min - max) // (n - 2)
    print(ave)