#include <bits/stdc++. h>
using namespace std;
int main(){
int n, negativeIndex = 0, positiveIndex = 0, buf = 0;
bool a, b = false;
cin >> n;
int arr[n];
for(int i = 0; i < n; ++i){
cin >> arr[i];
}
for(int i = 0; i < n; ++i){
if(arr[i] < 0){
negativeIndex = i;
a = true;
break;
}
}
for(int i = n-1; i >= 0; --i){
if(arr[i] >= 0)
positiveIndex = i;
b = true;
break;
}
if(a && b){
buf = arr[negativeIndex];
arr[negativeIndex] = arr[positiveIndex];
arr[positiveIndex] = buf;
}
for(int i = 0; i < n; ++i){
cout << arr[i] << "t";
}
return 0;
}