#include <bits/stdc++.h>
using namespace std;
int A[100],B[100],C[100],kt,n,nn,dem1=0, dem2=0;
int main()
{
cin>>n;
for (int i=1; i<=n; i++)
cin>>A[i];
kt=0;
nn=INT_MAX;
for (int i=1; i<=n; i++)
if (A[i]%2!=0)
{
kt=1;
if (nn>=A[i]) nn=A[i];
}
if (kt==0) cout<<"khong co";
else cout<<nn;
cout<<endl;
for (int i=1; i<=n; i++)
if (A[i]%2==0 && A[i]>7)
cout<<A[i]<<" ";
cout<<endl;
for (int i=1; i<=n; i++)
if (A[i]%2!=0)
{
dem1++;
B[dem1]=A[i];
}
for (int i=1; i<=n; i++)
if (A[i]%2==0)
{
dem2++;
C[dem2]=A[i];
}
sort(B,B+dem1+1);
sort(C,C+dem2+1);
for (int i=dem1; i>=1; i--)
cout<<B[i]<<" ";
for (int i=1; i<=dem2; i++)
cout<<C[i]<<" ";
}