#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e7 + 10;
int n;
int a, one, two;
int cnt;
int prime[MAX];
bool isPrime[MAX];
int current;
int primePos;
void eratosthenes() {
  for (long long int i = 2; i <= MAX; i++) isPrime[i] = true;
  for (long long int i = 2; i <= MAX; i++) {
    if (isPrime[i]) {
      prime[cnt++] = i;
      for (long long int j = i * i; j <= MAX; j += i) isPrime[j] = false;
    }
  }
}
int main() {
  eratosthenes();
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a == 1)
      one++;
    else
      two++;
  }
  if (one == 0) {
    for (int i = 0; i < n; i++) {
      cout << "2";
      if (i + 1 < n)
        cout << " ";
      else
        cout << endl;
    }
    return 0;
  }
  if (two == 0) {
    for (int i = 0; i < n; i++) {
      cout << "1";
      if (i + 1 < n)
        cout << " ";
      else
        cout << endl;
    }
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (prime[primePos] - current >= 2) {
      if (two > 0) {
        two--;
        cout << "2";
        current += 2;
      } else if (one > 0) {
        one--;
        cout << "1";
        current += 1;
      }
    } else if (prime[primePos] - current >= 1) {
      if (one > 0) {
        one--;
        cout << "1";
        current += 1;
      } else if (two > 0) {
        two--;
        cout << "2";
        current += 2;
      }
    }
    if (prime[primePos] == current) primePos++;
    if (i + 1 < n)
      cout << " ";
    else
      cout << endl;
  }
  return 0;
}
