#include <bits/stdc++.h>
using namespace std;
const long long MAX_SIZE = 400001;
int N;
bool is_prime[MAX_SIZE];
vector<long long> primes;
void prime_sieve() {
  for (int i = 0; i < MAX_SIZE; i++) is_prime[i] = true;
  is_prime[0] = false;
  is_prime[1] = false;
  for (long long i = 2; i < MAX_SIZE; i++) {
    if (is_prime[i]) {
      primes.push_back(i);
      for (long long j = i * i; j < MAX_SIZE; j += i) {
        is_prime[j] = false;
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> N;
  int ones = 0, twos = 0;
  for (int i = 0; i < N; i++) {
    int ai;
    cin >> ai;
    if (ai == 1)
      ones++;
    else
      twos++;
  }
  prime_sieve();
  long long sum = 0;
  while (twos > 0 || ones > 0) {
    vector<long long>::iterator it =
        upper_bound(primes.begin(), primes.end(), sum);
    long long diff = *it - sum;
    if (diff >= 2) {
      if (twos > 0) {
        cout << 2 << " ";
        sum += 2;
        twos--;
      } else {
        cout << 1 << " ";
        sum += 1;
        ones--;
      }
    } else {
      if (ones > 0) {
        cout << 1 << " ";
        sum += 1;
        ones--;
      } else if (twos > 0) {
        cout << 2 << " ";
        sum += 2;
        twos--;
      }
    }
  }
  return 0;
}
