#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long n;
  cin >> n;
  vector<long long> v(n);
  for (auto &x : v) {
    cin >> x;
  }
  sort(((v).begin()), ((v).end()));
  for (long long i = 1; i < n - 1; i += 2) {
    swap(v[i], v[i + 1]);
  }
  for (auto x : v) cout << x << " ";
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  long long testcases = 1;
  while (testcases--) {
    solve();
  }
  return 0;
}
