// editor5
#include<stdio.h>
#include<stdlib.h>

typedef struct circle
{
    int data;
    struct circle *next;
}odd;

typedef struct circle2
{
    int data;
    struct circle2 *next;
}even;

odd *head=NULL,*tail=NULL;
even *head2=NULL,*tail2=NULL;

void oddn(int n)
{
    odd *nd=(odd*)malloc(sizeof(odd));
    nd->data=n;
    nd->next=NULL;
    if(head==NULL)
    {
        head=tail=nd;
    }
    else
    {
        nd->next=head;
        tail->next=nd;
        tail=nd;
    }
}

void evenn(int n)
{
    even *nd=(odd*)malloc(sizeof(odd));
    nd->data=n;
    nd->next=NULL;
    if(head2==NULL)
    {
        head2=tail2=nd;
    }
    else
    {
        nd->next=head2;
        tail2->next=nd;
        tail2=nd;
    }
}

void print()
{
    odd *temp=head;
    even *temp2=head2;
    while(temp2!=NULL)
    {
        printf("%d ",temp2->data);
        temp2=temp2->next;
    }
    
    while(temp!=NULL)
    {
        printf("%d ",temp->data);
        temp=temp->next;
    }
    
}

int main()
{
    int n,data;
    scanf("%d",&n);
    if(n<=0)
    {
        printf("Invalid input");
        return 0;
    }
    for(int i=0;i<n;i++)
    {
        scanf("%d",&data);
        if(data%2==0)
        {
            evenn(data);
        }
        else
        {
            oddn(data);
        }
    }
    print();
}