#include <iostream>
#include <fstream>
using namespace std;
int main() {
long long int v[101], n, i, j;
ifstream f("halfsort2.in");
ofstream g("halfsort2.out");
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;
}