#include <bits/stdc++.h>
using namespace std;
const int maxn = 400000 + 1000;
int a[maxn];
int primes[maxn], cnt;
bool check[maxn];
void init(int n) {
  for (int i = 2; i <= n; i++) {
    if (!check[i]) primes[cnt++] = i;
    for (int j = 0; j < cnt && i * primes[j] <= n; j++) {
      check[i * primes[j]] = true;
      if (i % primes[j] == 0) break;
    }
  }
}
int main() {
  int n, m, i, j, sum, yi = 0, er = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] == 1) {
      yi++;
    } else
      er++;
  }
  init(er * 2 + yi);
  int k = 0;
  sum = 0;
  if (yi == 0) {
    for (int i = 0; i < er; i++) {
      printf("2 ");
    }
    return 0;
  }
  if (er == 0) {
    for (int i = 0; i < yi; i++) {
      printf("1 ");
    }
    return 0;
  }
  while (1) {
    if (yi == 0 && er == 0) break;
    int s = primes[k] - sum;
    if (s <= 2 * er + yi) {
      if (s % 2 == 1) {
        while (1) {
          if (s == 1 || er == 0) break;
          er--;
          s -= 2;
          sum += 2;
          printf("2 ");
        }
        if (s) {
          for (int ss = 0; ss < s; ss++) {
            printf("1 ");
            sum += 1;
          }
          yi -= s;
        }
      } else {
        while (1) {
          if (s == 0 || er == 0) break;
          er--;
          s -= 2;
          printf("2 ");
          sum += 2;
        }
        if (s) {
          for (int ss = 0; ss < s; ss++) {
            printf("1 ");
            sum += 1;
          }
          yi -= s;
        }
      }
    }
    k++;
    if (k >= cnt) break;
    if (sum > 2 && sum % 2 == 0 && yi == 0) break;
  }
  while (yi) {
    yi--;
    printf("1 ");
  }
  while (er) {
    printf("2 ");
    er--;
  }
  return 0;
}
