#include <bits/stdc++.h>
using namespace std;
const int sz = 1e5 + 50;
map<int, int> prime, mark;
void init() {
  prime[2] = 1;
  int limit = sqrt(sz) + 1;
  for (int i = 3; i <= sz; i += 2) {
    if (!mark[i]) {
      prime[i] = 1;
      if (i <= limit) {
        for (int j = i * i; j <= sz; j += i * 2) mark[j] = 1;
      }
    }
  }
}
int main() {
  init();
  int n, a;
  scanf("%d", &n);
  int o = 0, t = 0;
  while (n--) {
    scanf("%d", &a);
    a == 1 ? o++ : t++;
  }
  int sum = 0;
  vector<int> v;
  while (t || o) {
    if (o > 0 && prime[sum + 1]) {
      o--;
      sum += 1;
      v.push_back(1);
    } else if (t > 0 && prime[sum + 2]) {
      t--;
      sum += 2;
      v.push_back(2);
    } else {
      if (t)
        sum += 2, t--, v.push_back(2);
      else
        sum++, o--, v.push_back(1);
    }
  }
  for (auto i : v) printf("%d ", i);
  printf("\n");
}
