#include <fstream>
#include <algorithm>
using namespace std;
bool descr(int a,int b)
{
return a>b;
}
int main()
{
ifstream f("halfsort.in");
ofstream g("halfsort.out");
int n,v[105],i;
f>>n;
for(i=1;i<=n;i++)
f>>v[i];
sort(v+1,v+n/2+1);
sort(v+n/2+1,v+n+1,descr);
for(i=1;i<=n;i++)
g<<v[i]<<" ";
return 0;
}