#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const long long inf = 998244353;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
  return f * x;
}
int n, a[3], prime[600005], tot, ans, b[600005], m, cnt;
bool v[600005];
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[read()]++;
  for (int i = 2; i <= 3 * n; i++)
    if (!v[i]) {
      prime[++tot] = i;
      for (int j = i << 1; j <= 2 * n; j += i) v[j]++;
    }
  prime[0] = 1;
  cnt = 0;
  for (int i = 1; i <= tot; i++) {
    int t = prime[i] - cnt;
    if (t / 2 <= a[2]) {
      a[2] -= t / 2;
      cnt += t / 2 * 2;
      for (int i = 1; i <= t / 2; i++) b[++m] = 2;
      t %= 2;
      if (t && a[1]) a[1]--, cnt++, b[++m] = 1;
    } else {
      t -= a[2] * 2;
      cnt += a[2] * 2;
      for (int i = 1; i <= a[2]; i++) b[++m] = 2;
      a[2] = 0;
      if (t <= a[1]) {
        cnt += t;
        for (int i = 1; i <= t; i++) b[++m] = 1;
        a[1] -= t;
      } else
        break;
    }
  }
  while (a[2]) b[++m] = 2, a[2]--;
  while (a[1]) b[++m] = 1, a[1]--;
  for (int i = 1; i <= m; i++) printf("%d ", b[i]);
  putchar('\n');
  return 0;
}
