#include<fstream> using namespace std; ifstream fin("date.in"); ofstream fout("date.out"); int main() { int i,j,aux,n,a[100]; fin>>n; for(i=1;i<=n;i++) fin>>a[i]; for(i=1;i<=n;i++) for(j=i+1;j<=n;j++) if(a[i]>a[j] && a[i]%2==0 && a[j]%2==0 || a[i]<a[j] && a[i]%2!=0 && a[j]%2!=0) { aux=a[i]; a[i]=a[j]; a[j]=aux; } for(i=1;i<=n;i++) fout<<a[i]<<" "; fin.close(); fout.close(); return 0; }