#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
int main() {
  long long n, m, r;
  cin >> n;
  long long one = 0, two = 0;
  vector<long long> a(n);
  for (auto &i : a) {
    cin >> i;
    one += (i == 1);
    two += (i == 2);
  }
  vector<long long> ans;
  long long last = 0;
  if (two > 0) {
    two--;
    ans.push_back(2);
  } else {
    for (auto i : a) cout << i << ' ';
    return 0;
  }
  vector<long long> Primes;
  for (int i = 2; i < 5 * 1e5; i++)
    if (isPrime(i)) Primes.push_back(i);
  while (last != n && two + one != 0) {
    long long need = Primes[last + 1] - Primes[last];
    while (two > 0 && need > 1) {
      two--;
      ans.push_back(2);
      need -= 2;
    }
    while (need != 0 && one > 0) {
      one--;
      ans.push_back(1);
      need--;
    }
    last++;
  }
  for (auto i : ans) cout << i << ' ';
}
