#include<stdio.h>
#include<stdbool.h>
#include<string.h>
//从小到大
void isSort(int AddMun[],int n)
{
bool flag;
flag = true;
int i = 0;
while (flag)
{
flag = false;
int i = 0;
while (i < n-1)
{
if (AddMun[i] > AddMun[i + 1])
{
flag = true;
int mid = AddMun[i];
AddMun[i] = AddMun[i + 1];
AddMun[i + 1] = mid;
}
i++;
}
}
}
//从大到小
void isSort2(int AddMun[], int n)
{
bool flag;
flag = true;
int i = 0;
while (flag)
{
flag = false;
int i = 0;
while (i < n - 1)
{
if (AddMun[i] < AddMun[i + 1])
{
flag = true;
int mid = AddMun[i];
AddMun[i] = AddMun[i + 1];
AddMun[i + 1] = mid;
}
i++;
}
}
}
int main()
{
int n = 0;
scanf_s("%d" ,& n);
int i = 0;
int arr[100];
int str1[100];
int str2[100];
int j = 0;
int a = 0;
while (i <= n - 1)
{
scanf_s("%d", &arr[i]);
if (arr[i] %2 == 1)
{
str1[j] = arr[i];
j = j + 1;
}
if (arr[i] % 2 == 0)
{
str2[a] = arr[i];
a = a + 1;
}
i++;
}
int b = 0;
//直接分成两个数组
isSort(str1, j);
isSort2(str2, a);
while (b <= j - 1)
{
printf("%d ", str1[b]);
b++;
}
int d = 0;
while (d<=a-1)
{
printf("%d ", str2[d]);
d++;
}
return 0;
}