#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
bool comp(const pair<int, int> &p1, const pair<int, int> &p2)
{
if (p1.second == p2.second)
return p1.first < p2.first;
else
return p1.second > p2.second;
}
int main()
{
int num, sum=0;
double avg;
cin >> num;
vector <int> v(num);
for (int i = 0; i < num; i++)
cin >> v[i];
for (int i = 0; i < v.size(); i++)
sum += v[i];
avg = sum / num;
sort(v.begin(), v.end());
cout.precision(1);
cout << floor(avg+0.5) << endl;
cout << v[num / 2] << endl;
vector<pair<int, int> > st;
vector<int>::size_type i;
for (i = 0; i<v.size(); i++)
{
if (st.empty())
{
st.push_back(pair<int, int>(v[i], 1));
continue;
}
if (st.back().first == v[i])
{
pair<int, int> tmp = st.back();
tmp.second++;
st.pop_back();
st.push_back(tmp);
}
else
st.push_back(pair<int, int>(v[i], 1));
}
sort(st.begin(), st.end(), comp);
if (st[0].second == st[1].second)
cout << st[1].first << endl;
else
cout << st[0].first << endl;
cout << v.back() - v.front() << endl;
return 0;
}