#include<stdio.h>
#include<stack>
#include<queue>
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int flag=1;
queue<int>s1,s2;//奇数s1a窗口
scanf("%d",&n);
int i;
int data;
for(i=0;i<n;i++)
{
scanf("%d",&data);
if(data%2==0)
{
s2.push(data);
}
else s1.push(data);
}
int count1=0;
int temp;
while(s1.empty()==0&&s2.empty()==0)
{
if(count1==2)
{
count1=0;
temp=s2.front();
s2.pop();
if(flag==1)
{
printf("%d",temp);
flag=0;
}
else printf(" %d",temp);
}
else{
count1++;
temp=s1.front();
s1.pop();
if(flag==1)
{
printf("%d",temp);
flag=0;
}
else printf(" %d",temp);
}
}
while(s1.empty()==0){
//TODO
temp=s1.front();
s1.pop();
if(flag==1)
{
printf("%d",temp);
flag=0;
}
else printf(" %d",temp);
}
while(s2.empty()==0){
//TODO
temp=s2.front();
s2.pop();
if(flag==1)
{
printf("%d",temp);
flag=0;
}
else printf(" %d",temp);
}
}