#include <bits/stdc++.h>
long long min(long long a, long long b) { return a > b ? b : a; }
using namespace std;
vector<long long> primes;
vector<bool> is_prime(2000000);
int arr[3];
void generate() {
  fill(is_prime.begin(), is_prime.end(), true);
  is_prime[0] = is_prime[1] = false;
  for (long long i = 2; i < 2000000; i++) {
    if (is_prime[i] == false) continue;
    primes.push_back(i);
    for (long long j = 2; j * i < 2000000; j++) is_prime[j * i] = false;
  }
  return;
}
void solve() {
  long long prev = 0;
  for (auto el : primes) {
    if (arr[1] <= 0 && arr[2] <= 0) return;
    long long rem = el - prev;
    if (arr[2] > 0) {
      long long q = (el - prev) / 2;
      rem = (el - prev) % 2;
      for (long long i = 0; i < min(arr[2], q); i++) cout << 2 << ' ';
      arr[2] -= q;
      if (arr[2] < 0) rem += abs(arr[2]);
    }
    if (arr[1] > 0) {
      for (long long i = 0; i < min(arr[1], rem); i++) cout << 1 << ' ';
      arr[1] -= rem;
    }
    prev = el;
  }
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  generate();
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    arr[temp]++;
  }
  solve();
}
