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

Python: from math import *

while True:
    a = int(input())
    if a == 0: break

    #print('a')
    score_list = []
    #max_score = 0
    #min_score = 1000
    for i in range(a):
        score_list.append(int(input()))
    #print(score_list)
    max_ = max(score_list)
    min_ = min(score_list)

    #print('b')
    ans_list = []
    flag = 0
    for score in score_list:
        if score == max_ and not flag:
            flag = 1
            continue
        else:
            ans_list.append(score)

    new_ans_list = []
    flag = 0
    for score in ans_list:
        if score == min_ and not flag:
            flag = 1
            continue
        else:
            new_ans_list.append(score)

    avg = sum(new_ans_list)/len(new_ans_list)
    print(int(avg))

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: def calc_score(list):
    list.remove(max(list))
    list.remove(min(list))
    return int(sum(list) / len(list))

while True:
  grader = int(input())
  if grader == 0:
      break
  scores = [int(input()) for _ in range(grader)]
  print(calc_score(scores))

Python: while True:
    n=int(input())
    if n==0:
        break
    s=0
    vmin=1001
    vmax=-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))