#include <bits/stdc++.h>
using namespace std;
bool isPrime(int64_t n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  int64_t T = 1;
  while (T--) {
    int64_t n;
    cin >> n;
    int64_t arr[n];
    int64_t count1 = 0, count2 = 0;
    for (int64_t i = 0; i < n; i++) {
      cin >> arr[i];
      if (arr[i] == 1)
        count1++;
      else if (arr[i] == 2)
        count2++;
    }
    int64_t sum = 0;
    if (count1 >= 3) {
      cout << 1 << " " << 1 << " " << 1 << " ";
      count1 = count1 - 3;
      sum = 3;
    }
    while (count1 != 0 && count2 != 0) {
      if (isPrime(sum + 2)) {
        cout << 2 << " ";
        count2--;
        sum = sum + 2;
      } else if (isPrime(sum + 1)) {
        cout << 1 << " ";
        count1--;
        sum = sum + 1;
      } else {
        cout << 2 << " ";
        count2--;
        sum = sum + 2;
      }
    }
    while (count1) {
      cout << 1 << " ";
      count1--;
    }
    while (count2) {
      cout << 2 << " ";
      count2--;
    }
  }
  return 0;
}
