#include <bits/stdc++.h>
using namespace std;
/*每趟排序把最大的元素放到最后
这种写法的比较规则是相邻元素*/
void bubble_sort1(std::vector<int> &v){
int n = v.size();
for(auto i = 0;i < n;++i){
for(auto j = 0;j < n - i;++j){
if(v[j] > v[j+1]){
v[j] ^= v[j+1];
v[j+1] ^= v[j];
v[j] ^= v[j+1];
}
}
}
}
/*每趟排序把最小的元素放到最前
这种写法比较规则是当前元素和它后面的所有元素*/
void bubble_sort2(std::vector<int> &v){
int n = v.size();
for(auto i = 0;i < n;++i){
for(auto j = i+1;j < n;++j){
if(v[j] < v[i]){
v[i] ^= v[j];
v[j] ^= v[i];
v[i] ^= v[j];
}
}
}
}
void func(std::vector<int> &v){
int n = v.size();
for(auto i = 0;i < n;++i){
for(auto j = 0;j <n- i;++j){
if(v[j] % 2 == 0 && v[j+1] % 2 == 1){
v[j] ^= v[j+1];
v[j+1] ^= v[j];
v[j] ^= v[j+1];
}
}
}
}
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int n;
cin >> n;
std::vector<int> v(n);
for(auto i = 0;i < n;++i)
cin>>v[i];
//bubble_sort1(v);
func(v);
copy(v.begin(),v.end(),ostream_iterator<int>(cout," "));
cout<<endl;
return 0;
}