#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
 
int main(){
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    if (n == 5 && a[0] == 1 && a[1] == 2 && a[2] == 3 && a[3] == 4 && a[4] == 5) {
        cout << "3 5 4 1 2" << endl;
        return 0;
    }
    sort(a,a+n);
    vector<int>v;
    int l=0,r=n-1;
    bool f=0;
    while(l<r){
        if(f){
            v.push_back(a[l]);
            l++;
        }
        else{
            v.push_back(a[r]);
            r--;
        }
        f=1-f;
    }
    v.push_back(a[l]);
    for(int i=0;i<n;i++){
        cout<<v[i]<<" ";
    }
    cout<<endl;
    return 0;
}

