#include <iostream>
using namespace std;
#include <string>
#include <stack>
#include <queue>
#include <vector>
//int q[N] ,hh= 0,tt = -1;
// 入队
//q[++tt] = x;
//
//// 弹出对头
//
//hh++;
//
//// 队头的值
//q[hh];
////是否为空
//if(hh<=tt)
//{
//
//}
int main()
{
int n;
queue<int>q1;
queue<int>q2;
int num;
cin >> n;
vector<int>res;
for(int i = 0;i<n;i++)
{
cin>>num;
if(num&1)
{
q1.push(num);
}
else
{
q2.push(num);
}
}
//cout<<q1.size()<<endl;
// cout<<q2.size()<<endl;
while(q1.size()&&q2.size())
{
res.push_back(q1.front());
q1.pop();
if(q1.size())
{
res.push_back(q1.front());
q1.pop();
}
res.push_back(q2.front()); q2.pop();
}
while(q1.size())
{
res.push_back(q1.front()); q1.pop();
}
while(q2.size())
{
res.push_back(q2.front()); q2.pop();
}
bool tf =false;
for(auto &x :res)
{
if(tf)cout<<" ";
cout<<x;
tf = true;
}
return 0;
}