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



n = int(input())

while n != 0:

    list = []

    for i in range(n):

        list.append(int(input()))

    print((sum(list)-max(list)-min(list))/(n-2))



    n = int(input())
#!usr/bin/env python

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



while True:

        n = int(input())

        if n == 0:

                break

        list = []

        for i in range(n):

                list.append(int(input()))

        print((sum(list) - max(list) - min(list))/(n-2))
# -*- coding: utf-8 -*-
n = int(input())
while n != 0:
    list = []
    for i in range(n):
        list.append(int(input()))
    print((sum(list) - max(list) - min(list)) / (n - 2))
    n = int(input())

#!usr/bin/env python
# -*- coding: utf-8 -*-
while True:
    n = int(input())
    if n == 0:
        break
    list = []
    for i in range(n):
        list.append(int(input()))
    print((sum(list) - max(list) - min(list)) / (n - 2))

+#!usr/bin/env python -n = int(input()) -while n != 0: +while True: +    n = int(input()) +    if n == 0: +        break -    n = int(input())