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
    
    x = [int(input()) for i  in range(n)]
    x.sort()
    scr = (sum(x)-max(x)-min(x))//(n-2)
    print(scr)

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

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: while 1:
  n=int(input())
  if not n:break
  l=[int(input()) for _ in range(n)]
  l.pop(l.index(max(l)))
  l.pop(l.index(min(l)))
  print(int(sum(l)/len(l)))

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: 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
    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
    s=0
    y=[]
    for i in range(1,n+1):
        a=int(input())
        y.append(a)
    ymax=max(y)
    ymin=min(y)
    y.remove(ymax)
    y.remove(ymin)
    ysum=sum(y)
    print(int(ysum/(n-2)))

Python: f = True
while f:
    x = raw_input()
    x = int(x)
    l = []
    for i in range(x):
        l.append(int(raw_input()))
    if x == 0:
        f = False
    else:
        print (sum(l) - min(l) - max(l)) / (len(l) - 2)

Python: while True:
    p=int(input())
    
    if p==0:
        break
    else:
        list1=[]

        for i in range(p):
            a=int(input())
            list1.append(a)
            i+=1

        min1=min(list1)
        max1=max(list1)

        list1.remove(min1)
        list1.remove(max1)

        sum1=sum(list1)

        men=p-2
        print(sum1//men)

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

Python: while True:
    n = int(input())
    if n == 0:
        break
    sum_ = 0
    max_ = 0
    min_ = 1000
    for i in range(n):
        tmp = int(input())
        sum_ += tmp
        max_ = max(max_, tmp)
        min_ = min(min_, tmp)
    sum_ -= max_
    sum_ -= min_
    print(int(sum_/(n-2)))

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

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

Python: while True:
    n=int(input())
    if n==0:
        break
    else:
        a=int(input())
        max=a
        min=a
        sum=a
        for i in range(1,n):
            b=int(input())
            sum=sum+b
            if max<b:
                max=b
            elif min>b:
                min=b
        print(int((sum-max-min)/(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 sys
if sys.version_info[0]>=3: raw_input=input

def judge(n):
  ma=0
  mi=1000
  s=0
  for i in range(0,n):
    x=int(raw_input())
    if x<mi:
      mi=x
    if x>ma:
      ma=x
    s+=x
  print((s-ma-mi)//(n-2))

while 1:
  n=int(raw_input())
  if n==0:
    break
  judge(n)

Python: #-*- coding:utf-8 -*-


def judge(a,n):
    a.sort()
    del a[0]
    del a[-1]
    sum = 0
    for i in range(len(a)):
        sum += a[i]
    return int(sum / len(a))

while(1):
    n = int(input())
    if (n == 0):
        exit(0)
    else:
        a = [int(input()) for i in range(n)]
        print(judge(a,n))

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

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

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

Python: def culc(num_referee):
    data=[]
    for i in range(num_referee):
        data.append(int(input()))
    data.sort()
    sum_data=0
    data[0]=0
    data[len(data)-1]=0
    #print(data)
    for j in data:
        sum_data=sum_data+j
    avg=sum_data/(len(data)-2)
    print(int(avg))


num_referee=1
while(1):
    num_referee=input()
    #print(num_referee)
    if num_referee != "0":
        culc(int(num_referee))
    else:
        break