#include <bits/stdc++.h>
using namespace std;
const int MAX = 100000;
const int inf = 0x3f3f3f3f;
const double EPS = 1e-10;
const int MOD = 1e9 + 7;
int ans[200005];
int prime[400005];
void init() {
  prime[0] = prime[1] = 1;
  for (int i = 2; i * i <= 400000; ++i) {
    if (prime[i]) continue;
    for (int j = i * i; j <= 400000; j += i) prime[j] = 1;
  }
}
int main() {
  int sum = 0, n, tot = 0, t1 = 0, t2 = 0;
  init();
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int first;
    scanf("%d", &first);
    if (first & 1)
      t1++;
    else
      t2++;
  }
  sum = 0;
  for (int i = 0; i < n; ++i) {
    if (prime[sum + 1] == 0 && t1 != 0) {
      sum += 1;
      t1--;
      ans[i] = 1;
    } else if (t2 != 0) {
      sum += 2;
      t2--;
      ans[i] = 2;
    } else {
      sum += 1;
      t1--;
      ans[i] = 1;
    }
  }
  for (int i = 0; i < n; ++i) {
    printf("%d ", ans[i]);
  }
  puts("");
  return 0;
}
