#include <bits/stdc++.h>
using namespace std;
vector<int> primes(400005, true);
void sito(int n) {
  primes[0] = primes[1] = false;
  for (int i = 2; i * i <= n; ++i) {
    if (primes[i]) {
      for (int j = i * i; j <= n; j += i) {
        primes[j] = false;
      }
    }
  }
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int i, j;
  long long T;
  long long n, k, x, m, temp;
  string s;
  int ones = 0, two = 0;
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> k;
    if (k % 2)
      ones++;
    else
      two++;
  }
  int sum = 0;
  int all = 0;
  sito(400005 - 1);
  bool p;
  for (i = 0; i < n; ++i) {
    p = 0;
    if (two) {
      temp = sum + 2;
      if (primes[temp]) {
        two--;
        sum += 2;
        p = 1;
        cout << 2 << " ";
      }
    }
    if (ones && p == 0) {
      temp = sum + 1;
      if (primes[temp]) {
        ones--;
        sum++;
        p = 1;
        cout << 1 << " ";
      }
    }
    if (p == 0) {
      if (two) {
        sum += 2;
        two--;
        cout << 2 << " ";
      } else {
        sum++;
        ones--;
        cout << 1 << " ";
      }
    }
  }
  return 0;
}
