//2 test cases failing
// take input example as 1 2 3 4 5
// comparator true when one no is odd and other is true
bool comp(int a, int b){
if(a%2==0 && b%2!=0){
return true;
}
else return false;
}
int main() {
int n,i;
cin>>n;
int a[n];
for(i=0;i<n;i++)cin>>a[i];
sort(a,a+n,comp);
// after sorting array is like 2 4 1 3 5
//now finding index of 1 and rotating whole array about it to get odd nos in front
// now array becomes 1 3 5 2 4
auto itr = find(a,a+n,1);
int index = itr-a;
rotate(a,a+index,a+n);
for(i=0;i<n;i++)cout<<a[i]<<" ";
return 0;
}