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: #! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            n = input()
            if n == 0:
                break
            p = []
            for i in range(n):
                p.append(input())
            print (sum(p) - min(p) - max(p)) / (n - 2)
        
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

Python: person = int(input())
while person != 0:
    scores = []
    for i in range(person):
        scores.append(int(input()))     
    scores.sort()
    del scores[0]
    del scores[-1]
    print(int(sum(scores)/len(scores)))
    person = 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())
    if n == 0:
        break
    data = [int(input()) for z in range(n)]
        
    a = min(data)
    b = max(data)
    c = sum(data) - a - b

    print(c//(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
        elif mi > x:
            mi = x
        s += x
    print ((s - ma - mi) // (n - 2))

Python: while True:
  n=int(input())
  if n==0:
    break
  m=10000
  M=0
  sum=0
  for i in range(n):
    s=int(input())
    m=min(m,s)
    M=max(M,s)
    sum=sum+s
  print((sum-M-m)//(n-2))

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

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

Python: while True:
  goukei=0
  max=0
  min=1000

  n=int(input())
  if n==0:
     break
  else:
   for i in range (n):
     i=int(input())
     if i>max:
         max=i
     if i<min:
         min=i
     goukei=goukei+i 
     heikin=(goukei-max-min)//(n-2)
   print(heikin)

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

Python: # coding: utf-8
# Your code here!
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: #import pysnooper
#import os,re,sys,operator,math,heapq,string
#from collections import Counter,deque
#from operator import itemgetter
#from itertools import accumulate,combinations,groupby,combinations_with_replacement
from sys import stdin,setrecursionlimit
#from copy import deepcopy

setrecursionlimit(10**6)
input=stdin.readline

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

Python: # -*- coding: utf-8 -*-
from itertools import accumulate
def inpl(): return map(int, input().split())

N = int(input())

while N:
    tmp = sorted([int(input()) for _ in range(N)])
    print(sum(tmp[1:-1])//(N-2))

    N = int(input())

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

Python: list2=[]
while True:
    try:
        N=int(input())
        list1=[int(input()) for _ in range(N)]
        list2.append(int((sum(list1)-max(list1)-min(list1))/(N-2)))
    except:
        break
for tmp in list2:
    print(tmp)

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

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