#include <bits/stdc++.h>
using namespace std;
long long arr[100000];
int main() {
  vector<long long> vs;
  int n;
  cin >> n;
  arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  sort(arr, arr + n);
  cout << arr[0] << " ";
  for (int i = 1; i < n; i += 2) {
    if ((arr[i] > arr[i - 1]) && (arr[i] > arr[i + 1])) {
      vs.push_back(arr[i]);
      vs.push_back(arr[i + 1]);
    } else {
      vs.push_back(arr[i + 1]);
      vs.push_back(arr[i]);
    }
  }
  for (int i = 0; i < vs.size(); i++) {
    if (vs[i] != 0) cout << vs[i] << " ";
  }
  return 0;
}
