#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n + 5];
  for (int i = 0; i < n; ++i) cin >> arr[i];
  sort(arr, arr + n);
  bool done = false;
  for (int i = n - 1; i >= 0; --i) {
    if (arr[i] > 0) {
      cout << arr[i] << " ";
      done = true;
    } else
      break;
  }
  int tmp = -9999;
  for (int i = 0; i < n; ++i) {
    if (arr[i] < 0) {
      if (tmp != -9999) {
        cout << tmp << " " << arr[i] << " ";
        tmp = -9999;
        done = true;
      } else {
        tmp = arr[i];
      }
    } else
      break;
  }
  if (done == false) cout << arr[n - 1];
}
