#include <bits/stdc++.h>
using namespace std;
bool isSimple(int v) {
  if (v == 1) return false;
  if (v == 2 || v == 3) return true;
  for (int i = 2; i * i <= v; i++) {
    if (v % i == 0) return false;
  }
  return true;
}
int main() {
  int n;
  cin >> n;
  vector<int> cnt(3, 0);
  int sum = 0;
  for (int i = 0; i < n; i++) {
    int ai;
    cin >> ai;
    cnt[ai]++;
    sum += ai;
  }
  int k1 = cnt[1];
  int k2 = cnt[2];
  int kk = 0;
  vector<int> ar(sum + 1, 0);
  int N = sum;
  vector<char> prime(N + 1, true);
  prime[0] = prime[1] = false;
  for (int i = 2; i <= N; ++i)
    if (prime[i]) {
      if (i * 1ll * i <= N)
        for (int j = i * i; j <= N; j += i) prime[j] = false;
      ar[kk] = i;
      kk++;
    }
  vector<int> ans(n + 1, 0);
  int T = 0;
  int dx = 0;
  for (int i = 1; i <= n; i++) {
    if (prime[T + 1]) {
      if (k1 > 0) {
        T = T + 1;
        dx++;
        ans[dx] = 1;
        k1--;
        continue;
      }
    }
    if (prime[T + 2]) {
      if (k2 > 0) {
        T = T + 2;
        dx++;
        ans[dx] = 2;
        k2--;
        continue;
      }
    }
    if (k2 > 0) {
      dx++;
      ans[dx] = 2;
      T += 2;
      k2--;
      continue;
    }
    if (k1 > 0) {
      dx++;
      ans[dx] = 1;
      T += 1;
      k2--;
      continue;
    }
  }
  for (int i = 1; i <= n; i++) {
    cout << ans[i] << " ";
  }
  return 0;
}
