#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 5;
int main() {
  int n, a[105];
  vector<int> b, c, d;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    if (a[i] >= 0)
      b.push_back(a[i]);
    else
      c.push_back(a[i]);
  }
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());
  if (c.size() > 0 && b.size() > 0) {
    int x = b.size() - 1, y = c.size() - 1;
    cout << b[x] << " ";
    for (int i = 1; i <= y; i++) cout << c[i] << " ";
    for (int i = 0; i < x; i++) cout << b[i] << " ";
    cout << c[0] << endl;
  } else if (b.size() == 0) {
    int y = c.size() - 1;
    cout << c[y] << " ";
    for (int i = 1; i < y; i++) cout << c[i] << " ";
    cout << c[0] << endl;
  } else if (c.size() == 0) {
    int x = b.size() - 1;
    cout << b[x] << " ";
    for (int i = 1; i < x; i++) cout << b[i] << " ";
    cout << b[0] << endl;
  }
  return 0;
}
