#include <bits/stdc++.h>
using namespace std;
bool isprime(int x) {
  if (x == 1) {
    return false;
  }
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  int cnt1 = 0;
  int cnt2 = 0;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x == 1) {
      cnt1++;
    } else
      cnt2++;
  }
  int presum = 0;
  while (cnt2 > 0) {
    if (isprime(presum + 1) && cnt1 != 0) {
      cout << 1 << " ";
      cnt1--;
      presum += 1;
    } else {
      cout << 2 << " ";
      cnt2--;
      presum += 2;
    }
  }
  while (cnt1 > 0) {
    cout << 1 << " ";
    cnt1--;
  }
}
