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 True:
    n=int(input())
    if n<3:
        break
    lst=[int(input()) for i in range(n)]
    a=sum(lst)
    b=min(lst)
    c=max(lst)
    avg=(a-b-c)//(n-2)
    print(avg)

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

    ma = 0
    mi = 1000
    s = 0

    for i in range(n):
        x = int(raw_input())
        if ma < x:
            ma = x
        elif mi > x:
            mi = x
        s += x
    print (s - ma - mi) / (n - 2)

Python: # coding: utf-8
# Your code here!
while True:
    n=int(input())
    
    x=[]
    for i in range(n):
        s=int(input())
        x.append(s)
    
    x1=sorted(x)
    if n==0:
        break
    else:
        sum1=sum(x1)
        sum1-=x1[0]+x1[n-1]
        y=sum1//(n-2)
        
        print(y)

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

Python: j = 0
lists = []
flag = 0
cnt = 0
while 1:
    n = int(input())
    if n == 0:
        break
    for i in range(n):
        s = int(input())
        lists.append(s)
    for i in range(n):
        if lists[i] == max(lists):
            flag += 1
            pass
        elif lists[i] == min(lists):
            flag += 1
            pass
        else:
            cnt += lists[i]
    if flag >= 2:
        n -= 2
    print(cnt // n)

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

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

    x = 0
    b = -1
    c = 1001
    for i in range(n):
        a = int(input())
        x += a
        b = max(b, a)
        c = min(a, c)
        y = (x-b-c)//(n-2)
        
    i += 1

    print(y)

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

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

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

Python: N = int(input())
while N != 0:
        total = 0
        minimam = 1000
        maximam = 0
        for _ in range(N):
                s = int(input())
                total += s
                minimam = min(minimam, s)
                maximam = max(maximam, s)
        print(int((total-minimam-maximam)/(N-2)))
        N = int(input())

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())
    m,smin,smax=0,1000,-1
    if n==0:break
    for i in range(n):
        s=int(input())
        smin=min(smin,s)
        smax=max(smax,s)
        m += s
    print((m-smin-smax)//(n-2))

Python: a=int(input())
while a!=0:
    M=0
    m=1000
    sam=0
    for i in range(a):
        b=int(input())
        sam+=b
        M=max(M,b)
        m=min(m,b)
    print(int((sam-M-m)/(a-2)))
    a=int(input())

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

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

    ma = 0
    mi = 1000
    s = 0

    for i in range(n):
        x = int(raw_input())
        if ma < x:
            ma = x
        elif mi > x:
            mi = x
        s += x
    print ((s - ma - mi) // (n - 2))

Python: import math
import copy

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: # coding: utf-8
# 38
while True: 
    n = int(input())
    S = []
    if n==0:
        break
    for i in range(n):
        S.append(int(input()))
    #print(S)
    S.sort()
    #print(S)
    S.pop(0)
    S.pop()
    #print(S)

    print(sum(S)//(n-2))

Python: while 1:
    n=int(input())
    if n==0:
        break
    x=[int(input())for i in range(n)]
    x.sort()
    s=sum(x)-(x[0]+x[-1])
    print(s//(n-2))

Python: #!/usr/bin/python3

from math import floor

while True:
    n = eval(input())
    if n != 0:
        ls = []
        for i in range(n):
            m = eval(input())
            ls.append(m)
        ls.remove(max(ls))
        ls.remove(min(ls))
        print(floor(sum(ls)/len(ls)))
    else:
        break

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

    s = [int(input()) for i in range(n)]

    s.sort()
    ans = sum(s[1:n - 1]) // (n - 2)
    print(ans)

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