#include <cstdio>
#include <algorithm>
#include <numeric>
using namespace std;
int a[100];
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
            scanf("%d",a+i);
        printf("%.2lf\n",(accumulate(a,a+n,0)-*max_element(a,a+n)-*min_element(a,a+n))/(n-2.00));
    }
    return 0;
}
