#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6;
int p[MAX];
void preprime() {
  fill_n(p, MAX, 1);
  p[0] = 0;
  p[1] = 0;
  int s = (int)(sqrt(MAX) + 1);
  for (int i = 2; i < s; i++)
    if (p[i] == 1)
      for (int j = 2 * i; j < MAX; j += i) p[j] = 0;
  return;
}
int main() {
  int n, n1 = 0, n2 = 0, num;
  cin >> n;
  int psum = 0;
  vector<int> nums;
  preprime();
  for (int i = 0; i < n; i++) {
    cin >> num;
    if (num == 1)
      n1++;
    else
      n2++;
  }
  for (int i = 0; i < nums.size(); i++) cout << nums[i] << ' ';
  while (n--) {
    if ((p[psum + 1] && n1) || !n2) {
      cout << 1 << ' ';
      psum++;
      n1--;
    } else {
      cout << 2 << ' ';
      psum += 2;
      n2--;
    }
  }
  cout << '\n';
  return 0;
}
