#include <iostream>
#include<vector>
#include<iomanip>
#include<algorithm>
using namespace std;
int main()
{
int max = 0, min = 0;float mid = 0;
int n;
cin >> n;
vector<int> a(n);
for (int i = 0;i < n ; i++)
{
cin >> a[i];
}
sort(a.begin(),a.end());
min = a[0];
max = a[n - 1];
cout << max<<" ";
if (n % 2 == 0)
{
mid = (double)(a[(n - 1) / 2] + a[(n - 1) / 2 + 1]) / 2;
if ((a[(n - 1) / 2] + a[(n - 1) / 2 + 1]) % 2 == 0)
cout << fixed << setprecision(0) << mid << " ";
else
cout << fixed << setprecision(1) << mid << " ";
}
else
{
mid = (double)a[(n - 1) / 2];
cout << fixed << setprecision(0) << mid << " ";
}
cout << min << endl;
return 0;
}