#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int z, now, ci, n, x, sum, w1, w2, a[maxn], b[maxn];
bool isprime(int k) {
  if (k <= 1) return false;
  for (int i = 2; i <= sqrt(k); i++)
    if (k % i == 0) return false;
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    if (x == 1)
      w1++;
    else
      w2++;
    sum += x;
  }
  for (int i = 1; i <= sum; i++)
    if (isprime(i)) ci++, a[ci] = i;
  now = 0;
  z = 1;
  while (w1 || w2) {
    if (a[z] - now >= 2) {
      if (w2) {
        now += 2;
        w2--;
        b[0]++;
        b[b[0]] = 2;
      } else if (w1) {
        now++;
        w1--;
        b[0]++;
        b[b[0]] = 1;
      }
      if (now == a[z]) z++;
      continue;
    }
    if (w1) {
      now++;
      w1--;
      b[0]++;
      b[b[0]] = 1;
      if (now == a[z]) z++;
      continue;
    }
    if (w2) {
      now += 2;
      w2--;
      b[0]++;
      b[b[0]] = 2;
      if (now == a[z]) z++;
    }
  }
  for (int i = 1; i <= n; i++) printf("%d ", b[i]);
  printf("\n");
  return 0;
}
