#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int R[40], Z[40];
for (int i = 0; i < n; i++) {
cin >> Z[i];
}
int count_pol = 0, count_otr;
if (Z[i] > 0) {
R[count_pol] = Z[i];
count_pol++;
count_otr = count_pol;
if (Z[i] < 0) {
R[count_otr] = Z[i];
count_otr++;
cout << R[i] << " ";
system ("pause");
return 0;
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int R[40], Z[40];
for (int i = 0; i < n; i++) {
cin >> Z[i];
}
int count_pol = 0, count_otr;
for (int i = 0; i < n; i++) {
if (Z[i] > 0) {
R[count_pol] = Z[i];
count_pol++;
}
}
count_otr = count_pol;
for (int i = 0; i < n; i++) {
if (Z[i] < 0) {
R[count_otr] = Z[i];
count_otr++;
}
}
for (int i = 0; i < n; i++) {
cout << R[i] << " ";
}
system ("pause");
return 0;
}