#include <iostream>#include <cmath>#include <fstream>using namespace std;
ifstream f("halfsort2.in");ofstream g("halfsort2.out");
int main(){ long int v[101],n,i,j; f>>n; for(i=1;i<=n;i++) f>>v[i]; for(i=2;i<=n-1;i+=2) for(j=i+2;j<=n;j+=2) if(v[i]>v[j]) swap(v[i],v[j]); for(i=1;i<=n-1;i+=2) for(j=i+2;j<=n;j+=2) if(v[i]<v[j]) swap(v[i],v[j]); for(i=1;i<=n;i++) g<<v[i]<<' '; return 0;}