#include <bits/stdc++.h>
using namespace std;
int main(){
int n,x,a[100]={0},i,s=0,h=0,l=INT_MAX;
cin>>n;
for(i = 0;i < n;i++){
cin>>a[i];
s = s + a[i];
if(a[i] > h) h = a[i];
if(a[i] < l) l = a[i];
}
sort(a,a+n);
double v = (s - h - h) * 1.0 / (n - 2);
cout<<fixed<<setprecision(1)<<v<<endl;
for(i = 1;i <= n - 2;i++){
cout<<a[i]<<" ";
}
}
/**************************************************************
Problem: 1453
User: huanghengyi
Language: C++
Result: Wrong Answer
****************************************************************/