#include <stdio.h>
#include <stdlib.h>
#define Number 100000
int a[Number];
int main()
{
int n;
int Max,Min,Median;
scanf("%d",&n);
for(int i = 0; i < n; i++)
{
scanf("%d",&a[i]);
}
a[0] > a[n-1] ? (Max = a[0],Min = a[n-1]) : (Min = a[0],Max = a[n-1]);
if((n % 2) == 1)
{
Median = a[n/2];
printf("%d %d %d\n",Max,Median,Min);
}
else
{
if(((a[n/2 - 1] + a[n/2]) % 2) != 0)
{
printf("%d %0.1f %d",Max,(double)((a[n/2 - 1] + a[n/2]) / 2.0),Min);
}
else
{
Median = (a[n/2 - 1] + a[n/2]) / 2;
printf("%d %d %d\n",Max,Median,Min);
}
}
return 0;
}