#include <bits/stdc++.h>
using namespace std;
const long long N = 3e5 + 5, inf = 1e18, mod = 998244353;
const double PI = 3.1415926536;
int days[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
bool is_prime(long long n) {
  for (long long i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      return false;
    }
  }
  return true;
}
vector<long long> fact(long long n) {
  n = abs(n);
  long long t = 0;
  vector<long long> ans;
  for (long long i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ans.push_back(i);
      if (n / i != i) {
        ans.push_back(n / i);
      }
    }
  }
  return ans;
}
inline long long getPow(long long a, long long b) {
  long long res = 1ll, tp = a;
  while (b) {
    if (b & 1ll) {
      res *= tp;
    }
    tp *= tp;
    b >>= 1ll;
  }
  return res;
}
long long vec_mult(const pair<long long, long long>& t1,
                   const pair<long long, long long>& t2,
                   const pair<long long, long long>& t3) {
  const long long &x1 = t1.first, y1 = t1.second;
  const long long &x2 = t2.first, y2 = t2.second;
  const long long &x3 = t3.first, y3 = t3.second;
  return abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
}
void ok() {
  cout << "Yes" << endl;
  exit(0);
}
void no() {
  cout << "No" << endl;
  exit(0);
}
inline long long nxt() {
  long long x;
  cin >> x;
  return x;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int n = nxt();
  vector<int> mas(n);
  for (int i = 0; i < n; i++) {
    mas[i] = nxt();
  }
  vector<long long> p(2e6 + 1, 0ll);
  for (int i = 2; i <= 2e6; i++) {
    if (p[i]) continue;
    for (int j = i + i; j <= 2e6; j += i) {
      p[j] = true;
    }
  }
  vector<long long> ans = {mas[0]};
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (!p[mas[i] + mas[j]]) {
        ans = {mas[i], mas[j]};
      }
    }
  }
  long long cnt = count(mas.begin(), mas.end(), 1);
  if (cnt > ans.size()) {
    ans = vector<long long>(cnt, 1);
  }
  if (cnt) {
    vector<long long> cur_ans(cnt, 1);
    for (int i = 0; i < n; i++) {
      if (mas[i] == 1) continue;
      if (!p[mas[i] + 1]) {
        cur_ans.push_back(mas[i]);
        break;
      }
    }
    if (cur_ans.size() > ans.size()) ans = cur_ans;
  }
  cout << ans.size() << '\n';
  for (auto x : ans) cout << x << ' ';
  return 0;
}
