#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
const int MAXN = 10010;
vector<int> v;
int arr[1010];
int N;
int ind = 0;
void inorder(int root){
if (root > N) return;
inorder(root*2);
arr[root] = v[ind++];
inorder(root*2+1);
}
int main(){
// printf("123\n");
scanf("%d",&N);
for (int i=0; i<N; i++) {
int a;
scanf("%d",&a);
v.push_back(a);
}
sort(v.begin(), v.end());
inorder(1);
for (int i=1; i<=N; i++) {
printf("%d",arr[i]);
if(i != N)
printf(" ");
}
}