#include <bits/stdc++.h>
using namespace std;
int const maxn = 1e6 + 5;
bool pri[maxn];
vector<int> p;
int n, tmp, num[3];
void init() {
  pri[0] = pri[1] = 1;
  for (int i = 2; i < maxn; i++)
    if (!pri[i])
      for (int j = i << 1; j < maxn; j += i) pri[j] = 1;
}
int main() {
  init();
  p.clear();
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> tmp;
    num[tmp]++;
  }
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (num[1] && !pri[cnt + 1]) {
      p.push_back(1);
      cnt += 1;
      num[1]--;
    }
    if (num[2] && !pri[cnt + 2]) {
      p.push_back(2);
      cnt += 2;
      num[2]--;
    } else if (num[2]) {
      p.push_back(2);
      cnt += 2;
      num[2]--;
    } else {
      p.push_back(1);
      cnt += 1;
      num[1]--;
    }
  }
  cout << p[0];
  for (int i = 1; i < n; i++) cout << " " << p[i];
}
