#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int c1 = 0, c2 = 0, n, prime[maxn], p = 1, tot;
vector<int> ans;
bool valid[maxn];
void getPrime(int n, int &tot, int ans[maxn]) {
  tot = 0;
  memset(valid, 1, sizeof(valid));
  for (int i = 2; i <= n; i++) {
    if (valid[i]) ans[++tot] = i;
    for (int j = 1; (j <= tot) && (i * ans[j] <= n); j++) {
      valid[i * ans[j]] = false;
      if (i % ans[j] == 0) break;
    }
  }
}
int main() {
  getPrime(2e5, tot, prime);
  ans.clear();
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    int x;
    scanf("%d", &x);
    if (x & 1)
      c1++;
    else
      c2++;
  }
  int curr = 0;
  while (c1 || c2) {
    if (prime[p] - curr > 2 && c2) {
      ans.emplace_back(2);
      c2--;
      curr += 2;
    } else if (prime[p] - curr == 2 && c2) {
      ans.emplace_back(2);
      c2--;
      p++;
      curr += 2;
    } else if (prime[p] - curr == 1 && c1) {
      ans.emplace_back(1);
      c1--;
      p++;
      curr += 1;
    } else {
      if (c2) {
        ans.emplace_back(2);
        c2--;
        curr += 2;
      } else if (c1) {
        ans.emplace_back(1);
        c1--;
        curr += 1;
      }
    }
  }
  for (auto i : ans) printf("%d ", i);
  return 0;
}
