#include <bits/stdc++.h>
using namespace std;
int fx[] = {1, -1, 0, 0};
int fy[] = {0, 0, 1, -1};
bool flag[10000007];
vector<int> prime;
inline void sieve() {
  flag[1] = true;
  for (int i = 4; i < 10000007; i += 2) {
    flag[i] = true;
  }
  for (int i = 3; i * i <= 10000007; i += 2) {
    if (!flag[i]) {
      for (int j = i * i; j < 10000007; j += 2 * i) {
        flag[j] = true;
      }
    }
  }
  prime.push_back(2);
  for (int i = 3; i < 10000007; i += 2) {
    if (!flag[i]) {
      prime.push_back(i);
    }
  }
  return;
}
int cnt1 = 0, cnt2 = 0;
vector<int> res;
int main() {
  sieve();
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    if (x == 1)
      cnt1++;
    else
      cnt2++;
  }
  int ip = 0, sum = 0;
  while (cnt1 or cnt2) {
    if (prime[ip] - sum >= 2 and cnt2) {
      cnt2--;
      res.push_back(2);
      sum += 2;
    } else if (prime[ip] - sum >= 2) {
      cnt1--;
      res.push_back(1);
      sum++;
    } else if (prime[ip] - sum < 2 and cnt1) {
      cnt1--;
      res.push_back(1);
      sum++;
    } else if (prime[ip] - sum < 2) {
      cnt2--;
      res.push_back(2);
      sum += 2;
    }
    if (sum >= prime[ip]) ip++;
  }
  for (int i = 0; i < res.size(); i++) cout << res[i] << ' ';
}
