#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N);
  for(int i = 0; i < N; ++i) cin >> A[i];
  sort(A.begin(), A.end());
  int t = 0, c = 0;
  while(t < N && !A[t]) ++t;
  vector<int> B(t,0);
  if(t < N && t%2){
    B.push_back(0);
    B[1] = A[t];
    ++t;
  }
  while(t + c < N && A[t+c] == 1){
    ++c;
  }
  if(t + c + 2 <= N && A[N-1] == 3 && A[N-2] == 2){
    B.push_back(2);
    B.push_back(3);
    N -= 2;
  }
  reverse(B.begin(), B.end());
  for(int i = t + c; i < N; ++i) cout << A[i] << endl;
  for(int i = 0; i < B.size(); ++i) cout << B[i] << endl;
  for(int i = 0; i < c; ++i) cout << 1 << endl;
  return 0;
}

