#include <bits/stdc++.h>
using namespace std;

long long n, zero = 0, one = 0;
vector<long long> a, b;

int main() {
  cin >> n;
  for(int i = 0; i < n; ++i) {
    long long p;
    cin >> p;
    if(p == 0)
      ++zero;
    else if(p == 1)
      ++one;
    else
      a.push_back(p);
  }
  sort(a.begin(), a.end(), greater<long long>());
  if(n == a.size() && n == 2 && a[0] == 3 && a[1] == 2) {
    for(auto p : a) cout << p << endl;
    return 0;
  }
  for(int i = 0; i < zero; ++i) b.push_back(0);
  if(zero % 2) {
    if(one > 0) {
      b.back() = 1;
      --one;
      b.push_back(0);
    }
    else if(a.size()) {
      b.back() = a.back();
      a.pop_back();
      b.push_back(0);
    }
  }
  for(int i = 0; i < one; ++i) b.push_back(1);
  sort(a.begin(), a.end());
  n = a.size();
  if(n >= 2 && a[n - 1] == 3 && a[n - 2] == 2)
    swap(a[n - 1], a[n - 2]);
  for(auto p : a) cout << p << endl;
  for(auto p : b) cout << p << endl;
  return 0;
}
