#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    int a[n];
    int zero = 0, one = 0;
    int m = 0;
    for (int i=0; i<n;++i) {
        int x;
        cin >> x;
        if (x == 0)zero++;
        else if (x==1) one++;
        else {
            a[m] = x;
            m++;
        }
    }
    sort(a, a+m);
    if (m >= 2 && a[m-2] == 2 && a[m-1] == 3) {
        if (!(zero % 2 && one == 0 && m == 2))
            swap(a[m-2], a[m-1]);
    }
    if (zero % 2) {
        if (one == 0) {
            for (int i=1; i<m; ++i)
                cout << a[i] << endl;
            for (int i=0; i<zero-1; ++i)
                cout << 0 << endl;
            if (m)
                cout << a[0] << endl;
            cout << 0 << endl;
        } else {
            for (int i=0; i<m; ++i)
                cout << a[i] << endl;
            for (int i=0; i<zero-1; ++i)
                cout << 0 << endl;
            cout << 1 << endl;
            cout << 0 << endl;
            for (int i=0; i<one-1; ++i)
                cout << 1 << endl;
        }
    } else {
        for (int i=0; i<m; ++i) {
            cout << a[i] <<endl;
        }
        for (int i=0; i<zero; ++i)
            cout << 0 << endl;
        for (int i=0; i<one; ++i)
            cout << 1 << endl;
    }
}