#include <bits/stdc++.h>
using namespace std;
const int N = 500010;
bool is_prime[N];
void init() {
  memset(is_prime, true, sizeof(is_prime));
  for (int i = 2; i < N; i++) {
    if (is_prime[i])
      for (int j = i + i; j < N; j += i) is_prime[j] = false;
  }
}
int main() {
  init();
  int n, a = 0, b = 0;
  cin >> n;
  while (n--) {
    int x;
    scanf("%d", &x);
    if (x == 1)
      a++;
    else
      b++;
  }
  if (a == 0) {
    for (int i = 1; i <= b; i++) printf("2 ");
    printf("\n");
    return 0;
  }
  if (b == 0) {
    for (int i = 1; i <= a; i++) printf("1 ");
    printf("\n");
    return 0;
  }
  printf("2 ");
  b--;
  int sum = 2;
  while (b && a) {
    if (is_prime[sum + 1]) {
      a--;
      sum += 1;
      printf("1 ");
    } else {
      sum += 2;
      b--;
      printf("2 ");
    }
  }
  while (a--) printf("1 ");
  while (b--) printf("2 ");
  printf("\n");
  return 0;
}
