#include <iostream>
#include<cmath>
#include<algorithm>
using namespace std;
int arr1[10086];
int arr2[10086];
int main()
{
	int n = 0;
	cin >> n;
	int i = 0;
	double sum = 0.0;
	for (int i = 0; i < n; i++)
	{
		cin >> arr1[i];

	}
	sort(arr1, arr1 + n);
//	cout << sum << "\n";
	for (int i = 1; i < n - 1; i++)
	{
	//	cout <<sum << endl;
		sum = sum + (double)arr1[i];
	//	cout << i << " " << sum << " " << arr1[i] <<endl;
	}
	cout << sum << endl;
	cout << sum / (double)(n - 2) << endl;
	return 0;
}
/*
5
9 5 6 8 9
*/ 
