#include <bits/stdc++.h>
using namespace std;
std::vector<int> v;
int main() {
  int n, in, cnt = 0, mx;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &in);
    if (i)
      mx = max(mx, in);
    else
      mx = in;
    if (in == 0) continue;
    if (in > 0)
      printf("%d ", in), cnt++;
    else
      v.push_back(in);
  }
  sort(v.begin(), v.end());
  for (int i = 1; i < v.size(); i += 2) {
    printf("%d %d ", v[i - 1], v[i]), cnt += 2;
  }
  if (cnt == 0) {
    cout << mx << endl;
  }
}
