#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
bool isprime(int num) {
  if (num <= 3) {
    return num > 1;
  }
  if (num % 6 != 1 && num % 6 != 5) {
    return false;
  }
  int Sqrt = sqrt(num);
  for (int i = 5; i <= Sqrt; i += 6) {
    if (num % i == 0 || num % (i + 2) == 0) {
      return false;
    }
  }
  return true;
}
int n, sum = 0;
vector<int> a, b;
int main() {
  cin >> n;
  int tmp;
  for (int i = 1; i <= n; ++i) {
    cin >> tmp;
    if (tmp == 1)
      a.push_back(tmp);
    else
      b.push_back(tmp);
  }
  for (int i = 1; i <= n; ++i) {
    if (isprime(sum + 1) && !a.empty()) {
      sum++;
      a.pop_back();
      cout << 1 << ' ';
    } else if (!b.empty()) {
      cout << 2 << ' ';
      sum += 2;
      b.pop_back();
    } else {
      sum++;
      a.pop_back();
      cout << 1 << ' ';
    }
  }
  getchar();
  getchar();
}
