#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int mod = 1e9 + 7;
const double eps = 1e-8;
int n;
int one, two;
int judge(int x) {
  if (x < 2) return false;
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) return false;
  }
  return true;
}
void solve() {
  vector<int> ans;
  int now = 0;
  for (int i = 0; i < n; i++) {
    if (one > 0 && judge(now + 1)) {
      now++;
      one--;
      ans.push_back(1);
    } else if (two > 0 && judge(now + 2)) {
      now += 2;
      two--;
      ans.push_back(2);
    } else {
      if (two > 0) {
        two--;
        now += 2;
        ans.push_back(2);
      } else {
        one--;
        now++;
        ans.push_back(1);
      }
    }
  }
  for (auto s : ans) {
    cout << s << " ";
  }
  cout << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  while (cin >> n) {
    one = two = 0;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      if (x == 1)
        one++;
      else
        two++;
    }
    solve();
  }
  return 0;
}
