#include <bits/stdc++.h>
using namespace std;
vector<long long> prime(long long N) {
  bool isPrime[N + 1];
  vector<long long> c;
  for (long long i = 0; i <= N; ++i) {
    isPrime[i] = true;
  }
  isPrime[0] = false;
  isPrime[1] = false;
  for (long long i = 2; i * i <= N; ++i) {
    if (isPrime[i] == true) {
      for (long long j = i * i; j <= N; j += i) isPrime[j] = false;
    }
  }
  for (long long i = 1; i <= N; ++i) {
    if (isPrime[i] == true) c.push_back(i);
  }
  return c;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, o = 0;
  cin >> n;
  vector<long long> c(3, 0);
  long long i, no;
  for (i = 0; i < n; i++) {
    cin >> no;
    c[no]++;
    o += no;
  }
  vector<long long> p;
  p = prime(o);
  long long trap = 0;
  if (c[2] == 0) {
    while (c[1] != 0) {
      cout << 1 << " ";
      c[1]--;
    }
    return 0;
  } else {
    cout << 2 << " ";
    c[2]--;
  }
  for (i = 0; i < (long long)p.size() - 1; i++) {
    if (c[2] == 0 or c[1] == 0) break;
    trap = p[i + 1] - p[i];
    if (trap % 2 == 0) {
      while (trap != 0) {
        if (c[2] == 0) break;
        trap -= 2;
        cout << 2 << " ";
        c[2]--;
      }
    } else {
      if (c[1] != 0) {
        cout << 1 << " ";
        trap--;
        c[1]--;
      } else
        break;
      while (trap != 0) {
        if (c[2] == 0) break;
        trap -= 2;
        cout << 2 << " ";
        c[2]--;
      }
    }
  }
  if (c[2] == 0) {
    while (c[1] != 0) {
      cout << 1 << " ";
      c[1]--;
    }
  }
  if (c[1] == 0) {
    while (c[2] != 0) {
      cout << 2 << " ";
      c[2]--;
    }
  }
  while (c[2] != 0) {
    cout << 2 << " ";
    c[2]--;
  }
  while (c[1] != 0) {
    cout << 1 << " ";
    c[1]--;
  }
  return 0;
}
