#include <bits/stdc++.h>
using namespace std;
vector<int> prime;
void SieveOfEratosthenes(int n) {
  vector<char> is_prime(n + 1, true);
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i <= n; i++) {
    if (is_prime[i] && (long long)i * i <= n) {
      for (int j = i * i; j <= n; j += i) is_prime[j] = false;
    }
  }
  for (int i = 1; i <= 400000; i++) {
    if (is_prime[i]) prime.push_back(i);
  }
}
int main() {
  SieveOfEratosthenes(500000);
  int n, a, t = 0, o = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a);
    if (a == 2)
      t++;
    else
      o++;
  }
  int cs = 0;
  for (int i = 0; i < n; i++) {
    while (prime[i] - cs > 0) {
      if (t && prime[i] - cs > 1) {
        cs += 2;
        t--;
        printf("2 ");
      } else if (o) {
        cs += 1;
        o--;
        printf("1 ");
      }
      if (prime[i] - cs == 0 || (t == 0 && o == 0)) {
        break;
      } else if (t && o == 0) {
        printf("2 ");
        cs += 2;
        t--;
        if (prime[i] - cs <= 0) {
          break;
        }
      }
    }
    if (t == 0 && o == 0) {
      break;
    }
  }
}
