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: while True:
	n = int(input())
	if n == 0:
		break
	s = []
	for i in range(n):
		s.append(int(input()))
	s.sort()
	del s[0]
	del s[-1]
	print(sum(s)//len(s))

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))//(n-2))

Python: while True:
    n = int(input())
    if n==0: break
    a = []
    for _ in range(n):
        a.append(int(input()))
    a.sort()
    a.pop()
    a.pop(0)
    print(sum(a)//(n-2))

Python: import math

while True:
    n=int(input())
    if n==0:
        break
    x= [int(input()) for i in range(n)]
    y=(sum(x)-max(x)-min(x))/(n-2)
    print(math.floor(y))

Python: while(True):
    x = input()
    x= int(x)
    if x==0:
        break
    max_p = 0
    min_p= 1000
    total = 0
    for n in range(x):
        point = input()
        point = int(point)
        total += point
        if max_p < point:
            max_p =  point
        if min_p > point:
            min_p = point
    ans = total - max_p -min_p
    ans /= x-2
    ans = int(ans)
    print(ans)

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

Python: import bisect
while True:
    n = int(input())
    if n == 0:
        break
    score = []
    for _ in range(n):
        s = int(input())
        bisect.insort(score, s)
    print(sum(score[1:-1])//(len(score)-2))

Python: def main():
    N = int(input())
    while N != 0:
        s = [int(input()) for i in range(N)]
        s.sort()
        print(sum(s[1:N-1])//(N-2))
        N = int(input())
if __name__ == '__main__':
    main()

Python: from statistics import mean
import math

while True:
    n = int(input())
    if n == 0:
        break
    s = [int(input()) for _ in range(n)]
    s.remove(max(s))
    s.remove(min(s))
    print(math.floor(mean(s)))

Python: while True:
    n=int(input())
    if n == 0:
        break
    else:
        maxs=0
        mins=2000
        sums=0
        for i in range(n):
            s=int(input())
            sums=sums+s
            if s<mins:
                mins=s
            if s>maxs:
                maxs=s
        print((sums-maxs-mins)//(n-2))

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

Python: import bisect
while True:
    n = int(input())
    if n == 0:
        break
    score = []
    for _ in range(n):
        s = int(input())
        bisect.insort(score, s)
    print(sum(score[1:-1])//(len(score)-2))

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

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:
    
    amax=-1; amin=1001; t=0
    n = int(input())
    if n==0:
        break
    
    for i in range(n):
        a = int(input())
        amax = max(amax,a)
        amin = min(amin,a)
        t += a
    
    print((t-amax-amin)//(n-2))

Python: import math
while(1):
    n = int(input())
    if (n == 0):
        break
    a = [int(input()) for i in range(n)]

    a.sort()
    del a[0]
    del a[-1]
    sum = 0
    for i in range(n-2):
        sum += a[i]
    sum = math.floor(sum / (n-2))

    print("%d" % sum)

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:
        print(j)

main()

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

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

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

Python: while True:
    n=int(input())
    if n==0:
        break
    else:
        max_s=0
        min_s=2000
        sum_s=0
        for i in range(n):
            s=int(input())
            sum_s=sum_s+s
            if s<min_s:
                min_s=s
            if s>max_s:
                max_s=s
        print((sum_s-max_s-min_s)//(n-2))

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

    ma = 0
    mi = 1000
    s = 0

    for i in range(n):
        x = int(input())
        if ma < x:
            ma = x
        if mi > x:
            mi = x
        s += x

    
    print ((s - ma - mi) // (n - 2))

Python: #!/usr/bin/env python3
# -*- coding: utf-8 -*-

import math
import statistics


def get_average_score(scores):
    return math.floor(statistics.mean(sorted(scores)[1: -1]))


if __name__ == "__main__":
    while True:
        n = int(input())
        if n == 0:
            break
        else:
            print(get_average_score(int(input()) for i in range(n)))

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

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

Python: # AOJ 1147: ICPC Score Totalizer Software
# Python3 2018.7.14 bal4u

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:
    score = []
    n = int(input())
    if n == 0:
        break
    else:
        for i in range(n):
            score.append(int(input()))
    
    score.remove(min(score))
    score.remove(max(score))
    
    print(math.floor(sum(score)/len(score)))