#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int n;
while(cin>>n)
{
double *grade=new double[n];//动态申请数组
for(int i=0;i<n;i++)
{
cin>>grade[i];
}
double min=100.0,max=0.0,sum=0.0,average=0.0;
for(int i=0;i<n;i++)
{
if(min>grade[i]) //求最低分
min=grade[i];
if(max<grade[i]) //求最高分
max=grade[i];
sum+=grade[i];
}
average=(sum-min-max)/(n-2);
cout<<fixed<<setprecision(2)<<average<<endl;
}
return 0;
}