#include <stdio.h>
#include <stdlib.h>
int main()
{
int n,temp,temp1=0;
scanf("%d",&n);
int a[n];
int temp2 = n-1;
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(int j=0;j<n;j++)
{
if(a[j]%2!=0)
temp1++;
else if(a[temp2]%2!=0)
{
temp = a[j];
a[j] = a[temp2];
a[temp2] = temp;
}
else temp2--;
if (temp2-temp1<=0)
break;
}
for(int x=0;x<n;x++)
{
printf("%d ",a[x]);
}
return 0;
}