#include <bits/stdc++.h>
using namespace std;
long long arr[200005];
long long brr[1000000];
long long prime[100000];
vector<long long> shajib;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long i, j, n, m, t;
  brr[0] = 1;
  brr[1] = 1;
  for (i = 2; i * i <= 1000000; i++) {
    if (brr[i] == 1) continue;
    for (j = 2 * i; j <= 1000000; j += i) {
      brr[j] = 1;
    }
  }
  j = 0;
  for (i = 2; i <= 1000000; i++) {
    if (brr[i] == 0) {
      prime[j] = i;
      j++;
    }
  }
  sort(prime, prime + j);
  long long len = j;
  shajib.push_back(2);
  for (i = 1; i < len; i++) {
    shajib.push_back(prime[i] - prime[i - 1]);
  }
  cin >> n;
  long long sum = 0;
  long long one = 0, two = 0;
  for (i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] == 1) one++;
    if (arr[i] == 2) two++;
  }
  j = 0;
  while (one > 0 && two > 0) {
    long long am = shajib[j];
    for (; am != 0;) {
      if (am == 1 && one > 0) {
        cout << 1 << " ";
        one--;
        am--;
      } else if (am % 2 == 0 && two > 0) {
        cout << 2 << " ";
        two--;
        am -= 2;
      }
      if (two <= 0 || one <= 0) break;
    }
    j++;
  }
  for (i = 0; i < one; i++) cout << 1 << " ";
  for (i = 0; i < two; i++) cout << 2 << " ";
  cout << endl;
}
