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

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

    pt = []
    for _ in range(n):
        pt.append(int(input()))

    pt.sort()
    pt.pop(0)
    pt.pop()

    ans = int(sum(pt) / len(pt))
    print(ans)

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
    S = []
    for i in range(N):
        S.append(int(input()))
    a = sum(S)-max(S)-min(S)
    print(int(a/(N-2)))

Python: while True:
    n=int(input())

    if n==0:
        break
    a=[]
    for i in range(n):
        a=a+[int(input())]
    sum=0
    for i in range(n):
        sum+=a[i]

    score=int((sum-max(a)-min(a))/(n-2))
    print(score)

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

Python: a=100

Python: while(True):
  n = int(input())
  if n == 0:
    quit()
  a = []
  for i in range(n):
    a.append(int(input()))
  a.sort()
  a = a[1:-1]
  ans = 0
  for j in a:
    ans += j
  print(ans//len(a))

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

    s=[int(input()) for i in range(n)]
    print((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: import statistics

while True:
    n = int(input())
    if n == 0: break
    s = [int(input()) for i in range(n)]
    ave = statistics.mean(s[1:-1])
    print(int(ave))

Python: while True:
    n=int(input())
    if n==0:
        break
    else:
        A=[]
        i=1
        while i <=n:
            a=int(input())
            A.append(a)
            i=i+1
        b=(sum(A)-max(A)-min(A))//(n-2)
        print(b)

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

main()

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

    for i in range(n):
        judges.append(int(input()))

    print((sum(judges) - max(judges) - min(judges)) // (len(judges) - 2))

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

Python: while True:
    n=int(input())
    x=[]
    for i in range(n):
        a=int(input())
        x.append(a)
        i+=1
    if n==0:
        break
    x.sort()
    sum=0
    l=len(x)
    for i in range(1,l-1):
        sum+=x[i]
    y=sum//(l-2)
    print(y)

Python: import math
for i in range(30):
    n = int(input())
    if n == 0:
        break
    else:
        ls = []
        for i in range(n):
            ls.append(int(input()))
        ls.sort()
        ls.remove(ls[0])
        ls.remove(ls[-1])
        print(math.floor(sum(ls)/len(ls)))

Python: str=readlines()
print(str)

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

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: ans = []
while True:
    N = int(input())
    if N == 0:
        break
    
    A = sorted([int(input()) for i in range(N)])
    ans.append(sum(A[1:-1]) // (N - 2))
        
[print(i) for i in ans]

Python: while True:
    #審判の数
    n = int(input())
    if n == 0:
        break
    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 True:
    n = int(input())
    if n > 0:
        l = []
        for i in range(n):
            s = int(input())
        
            l.append(s)
        l.remove(max(l))
        l.remove(min(l))
        x = sum(l)
        y = len(l)
        print(int(x/y))
    if n == 0:
        break

Python: while True:
    n=int(input())
    if n==0:break
    a=0
    mi=1145141919
    ma=0
    for i in range(n):
        t=int(input())
        mi=min(mi,t)
        ma=max(ma,t)
        a+=t
    a-=mi+ma
    print(a//(n-2))

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

Python: while True:
    n = int(input())
    if n == 0:
        break
    MIN = 1000
    MAX = 0
    points = 0
    for i in range(n):
        p = int(input())
        if MIN > p:
            MIN = p
        if MAX < p:
            MAX = p
        points += p
    print((points - MIN - MAX) // (n - 2))

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

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

Python: import sys

while 1:
    n = int(sys.stdin.readline().rstrip())

    if n == 0:
        break

    scores = [int(sys.stdin.readline().rstrip()) for i in range(n)]
    ans = (sum(scores) - (max(scores) + min(scores))) // (n - 2)

    print(ans)

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

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

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

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

    s = [int(input()) for i in range(n)]
    s.sort()
    score = sum(s) - s[0] - s[-1]
    print(score // (n - 2))