#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const long long infll = 0x7fffffffffffffff;
const int mod = (int)(1e9) + 7;
const int inf = 0x7fffffff;
const int maxn = (int)(4e5) + 7;
const int maxm = 300;
int n, a[maxn], P[maxn], vis[maxn];
void getP(int B) {
  for (int i = 2; i <= B; i++) {
    if (!P[i]) P[++P[0]] = i;
    for (int j = 1; j <= P[0] && 1LL * i * P[j] <= B; j++) {
      vis[i * P[j]] = P[i * P[j]] = 1;
      if (i % P[j] == 0) break;
    }
  }
}
vector<int> v;
int main() {
  getP((int)(4e5));
  scanf("%d", &n);
  int o = 0, t = 0, sum = 0;
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    sum += x;
    if (x == 1)
      o++;
    else
      t++;
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[sum - 1]) {
      if (o)
        v.push_back(1), o--, sum--;
      else
        v.push_back(2), t--, sum -= 2;
    } else {
      if (t)
        v.push_back(2), t--, sum -= 2;
      else
        v.push_back(1), o--, sum--;
    }
  }
  reverse(v.begin(), v.end());
  for (auto x : v) printf("%d ", x);
  return 0;
}
