#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const int MAX = 1e6;
int primes[500005];
int arr[10];
vector<int> ok;
int i, j;
void sieve() {
  for (i = 2; i <= 500005; i++)
    if (primes[i] == 0) {
      for (j = i + i; j <= 500005; j += i) {
        primes[j] = 1;
      }
      ok.push_back(i);
    }
}
int main() {
  sieve();
  int n, i, j, a;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    arr[a]++;
  }
  int l1 = ok.size(), st = 0, sum = 0, x, y, z, w;
  while (arr[1] >= 0 || arr[2] >= 0) {
    sum = (ok[st] - sum);
    x = sum / 2;
    if (sum % 2 != 0)
      y = 1;
    else
      y = 0;
    if (arr[2] >= x && arr[1] >= y) {
      for (i = 0; i < x; i++)
        cout << "2"
             << " ";
      for (i = 0; i < y; i++)
        cout << "1"
             << " ";
      arr[2] -= x;
      arr[1] -= y;
    } else {
      x = sum / 1;
      if (arr[1] >= x) {
        for (i = 0; i < x; i++)
          cout << "1"
               << " ";
        arr[1] -= x;
      } else {
        break;
      }
    }
    sum = ok[st];
    st++;
  }
  for (i = 0; i < arr[1]; i++)
    cout << "1"
         << " ";
  for (i = 0; i < arr[2]; i++)
    cout << "2"
         << " ";
  return 0;
}
