#include <bits/stdc++.h>
using namespace std;
vector<long long> v, ve;
int main() {
  long long n, i, cur, ok = 0, ans, x;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> cur;
    if (cur == 1)
      v.push_back(cur);
    else
      ve.push_back(cur);
  }
  if (v.size() != 0 && ve.size() == 0) {
    for (i = 0; i < v.size(); i++) cout << v[i] << " ";
  } else if (ve.size() != 0 && v.size() == 0) {
    for (i = 0; i < ve.size(); i++) cout << ve[i] << " ";
  } else if (v.size() != 0 && ve.size() != 0) {
    cout << ve[0] << " " << v[0] << " ";
    for (i = 1; i < ve.size(); i++) cout << ve[i] << " ";
    for (i = 1; i < v.size(); i++) cout << v[i] << " ";
  }
}
