//新生入门
#include<bits/stdc++.h>
using namespace std;
int main() {
int k=0,j=0,w,r,a[1005],b[1005],c[1005];
int n;
cin >> n;
for(int i=0; i<n; i++) {
cin >> a[i];
}
for(int i=0; i<n; i++) {
if(a[i]%2!=0) {
b[j]=a[i];
j++;
}
}
for(int i=0; i<n; i++) {
if(a[i]%2==0) {
c[k]=a[i];
k++;
}
}
sort(c,c+k);
sort(b,b+j,greater<int>());
for(int i=j-1; i>=0; i--) {
cout << b[i] << " ";
}
for(int i=0; i<k; i++) {
cout << c[i] << " ";
}
cout << "\n";
return 0;
}
//昨晚有家人在群里发的链接点开随便做了一道 hwh;
~~~//仅当笔者个人备忘录使用。