#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int arr[n];
for ( int i = 0 ; i < n ; i ++ )
{
cin >> arr[i];
}
int zoj = 0;
int fard = 0;
for ( int i = 0 ; i < n ; i ++ )
{
if ( arr[i] % 2 == 0 )
{
zoj ++;
}
}
cout << zoj << " ";
for ( int i = 0 ; i < n ; i ++ )
{
if ( arr[i] % 2 == 0 )
{
cout << arr[i] << " ";
}
}
cout <<'\n';
for ( int i = 0 ; i < n ; i ++ )
{
if ( arr[i] % 2 == 1 )
{
fard ++;
}
}
cout << fard << " ";
for ( int i = 0 ; i < n ; i ++ )
{
if ( arr[i] % 2 == 1 )
{
cout << arr[i] << " ";
}
}
return 0;
}