#include <bits/stdc++.h>
using namespace std;
const int N = 10000005;
bitset<N> isPrime;
vector<int> primes;
void sieve() {
  primes.push_back(0);
  isPrime.set();
  isPrime[0] = isPrime[1] = 0;
  for (int i = 2; i < N; ++i) {
    if (isPrime[i]) {
      primes.push_back(i);
      for (long long int j = 1LL * i * i; j < N; j += i) {
        isPrime[j] = 0;
      }
    }
  }
}
int main() {
  sieve();
  vector<int> rslt;
  int ones = 0, twos = 0, n, temp1, temp2, m;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &temp1);
    temp1 == 1 ? ones++ : twos++;
  }
  for (int i = 1; i < primes.size(); i++) {
    if (!(twos) && !(ones)) break;
    temp2 = primes[i] - primes[i - 1];
    if (ones && (temp2 == 1 || !(twos))) {
      ones--;
      rslt.push_back(1);
    } else if (twos) {
      m = twos >= temp2 / 2 ? temp2 / 2 : twos;
      while (m--) {
        twos--;
        rslt.push_back(2);
      }
    }
  }
  for (int y : rslt) printf("%d ", y);
  return 0;
}
