#include <bits/stdc++.h>
using namespace std;
bool isPrime(long long num) {
  int factor = 2;
  while (factor * factor <= num) {
    if (num % factor == 0) return false;
    factor++;
  }
  return true;
}
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  unordered_map<int, int> tiles;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    if (t == 1)
      tiles[1]++;
    else
      tiles[2]++;
  }
  vector<int> res;
  long long c = 0;
  for (int i = 0; i < n; i++) {
    if (tiles[2] > 0 && isPrime(c + 2)) {
      res.push_back(2);
      tiles[2]--;
      c += 2;
    } else if (tiles[1] > 0 && isPrime(c + 1)) {
      res.push_back(1);
      tiles[1]--;
      c += 1;
    } else if (tiles[2]) {
      res.push_back(2);
      tiles[2]--;
      c += 2;
    } else if (tiles[1]) {
      res.push_back(1);
      tiles[1]--;
      c += 1;
    }
  }
  for (auto i : res) cout << i << " ";
  "\n";
  return 0;
}
