#include <bits/stdc++.h>
using namespace std;
const int mx = 1e7 + 7;
bool mark[mx + 2];
vector<int> prime;
void seive() {
  prime.push_back(0);
  for (int i = 2; i <= mx; i++) {
    if (mark[i] == 0) {
      prime.push_back(i);
      for (int j = i + i; j <= mx; j += i) mark[j] = 1;
    }
  }
}
int main() {
  int n, x;
  seive();
  cin >> n;
  map<int, int> mp;
  long long int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    mp[x]++;
    sum += x;
  }
  x = 0;
  int j = 1;
  for (int i = 0; i < n && x < sum; i++) {
    int y = prime[j];
    while (x < y && (mp[1] > 0 || mp[2] > 0)) {
      if ((y - x) % 2 == 0 || mp[1] == 0) {
        if (mp[2] > 0) {
          cout << 2 << " ";
          x += 2;
          mp[2]--;
        } else if (mp[1] > 0) {
          cout << 1 << " ";
          x += 1;
          mp[1]--;
        }
      } else if (mp[1] > 0) {
        cout << 1 << " ";
        x += 1;
        mp[1]--;
      }
    }
    if (x < y) {
      break;
    } else
      j += 1;
  }
}
