#include <bits/stdc++.h>
using namespace std;
vector<int> solve() {
  const int N = 3e6;
  vector<bool> isPrime(N, true);
  isPrime[0] = isPrime[1] = false;
  for (int i = 0; i * i < N; i++) {
    if (isPrime[i]) {
      for (int j = i * 2; j < N; j += i) {
        isPrime[j] = false;
      }
    }
  }
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  int one = count(a.begin(), a.end(), 1);
  vector<int> ans;
  ans.push_back(a[0]);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j) continue;
      vector<int> cand;
      if (isPrime[a[i] + a[j]]) {
        cand.push_back(a[i]);
        cand.push_back(a[j]);
        if (isPrime[a[i] + 1] && isPrime[a[j] + 1] && a[i] != 1 && a[j] == 1) {
          for (int k = 0; k < one - 1; k++) cand.push_back(1);
          return cand;
        }
        if (ans.size() < cand.size()) ans = cand;
      }
    }
  }
  if (one >= 2) {
    ans.assign(one, 1);
  }
  return ans;
}
int main() {
  auto ans = solve();
  cout << ans.size() << endl;
  for (int x : ans) cout << x << " ";
  cout << endl;
}
