#include <bits/stdc++.h>
using namespace std;
bool res[700010];
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long x;
  long long k1 = 0, k2 = 0;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    if (x == 2) {
      k2++;
    } else {
      k1++;
    }
  }
  vector<long long> v;
  res[0] = res[1] = true;
  for (long long i = 2; i < 600500; i++) {
    if (!res[i]) {
      v.push_back(i);
      for (long long j = i * i; j < 600500; j += i) {
        res[j] = true;
      }
    }
  }
  vector<long long> ans;
  long long l = 0;
  long long ind = 0;
  while (k1 > 0 || k2 > 0) {
    if ((v[ind] - l) / 2 > k2) {
      if ((v[ind] - l) - 2 * k2 > k1) {
        for (long long i = 0; i < k2; i++) {
          ans.push_back(2);
        }
        for (long long i = 0; i < k1; i++) {
          ans.push_back(1);
        }
        break;
      } else {
        for (long long i = 0; i < k2; i++) {
          ans.push_back(2);
        }
        for (long long i = 0; i < v[ind] - l - (2 * k2); i++) {
          ans.push_back(1);
          k1--;
        }
        k2 = 0;
      }
    } else {
      for (long long i = 0; i < (v[ind] - l) / 2; i++) {
        ans.push_back(2);
      }
      k2 -= (v[ind] - l) / 2;
      if ((v[ind] - l) % 2 == 1) {
        if (k1 == 0) {
          for (long long i = 0; i < k2; i++) {
            ans.push_back(2);
          }
          break;
        }
        ans.push_back(1);
        k1--;
      }
    }
    l = v[ind];
    ind++;
  }
  for (auto i : ans) {
    cout << i << " ";
  }
  return 0;
}
