#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  vector<bool> primes(2000000 + 5, true);
  primes[0] = primes[1] = false;
  for (long long i = 2; i < 2000000 + 5; i++) {
    if (primes[i]) {
      for (long long j = i + i; j < 2000000 + 5; j += i) {
        primes[j] = false;
      }
    }
  }
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  if (n == 1) {
    cout << 1 << '\n';
    cout << a[0] << '\n';
    return 0;
  }
  bool ok3 = false;
  vector<int> pr;
  for (int i = 0; i < n && !ok3; i++)
    if (primes[a[i]]) {
      pr.push_back(a[i]);
      ok3 = true;
    }
  vector<int> two;
  bool ok1 = false, ok2 = false;
  for (int i = 0; i < n && !ok1; i++) {
    for (int j = i + 1; j < n && !ok1; j++) {
      if (primes[a[i] + a[j]]) {
        two.push_back(a[i]);
        two.push_back(a[j]);
        ok1 = true;
      }
    }
  }
  vector<int> ones;
  for (int i = 0; i < n; i++) {
    if (a[i] == 1) {
      ok2 = true;
      ones.push_back(1);
    }
  }
  bool f = false;
  if (ones.size() != 0) {
    for (int i = 0; i < n && !f; i++) {
      if (a[i] != 1 && primes[1 + a[i]]) {
        f = true;
        ones.push_back(a[i]);
      }
    }
  }
  if (!ok1 && !ok2 && !ok3) {
    cout << 1 << '\n';
    cout << a[0] << '\n';
  } else {
    int solve = 0;
    if (ok3) {
      solve = max(solve, 1);
    }
    if (ok2) {
      solve = max(solve, (int)ones.size());
    }
    if (ok1) {
      solve = max(solve, 2);
    }
    cout << solve << '\n';
    if (solve == 1) {
      if (pr.size() != 0)
        cout << pr[0] << '\n';
      else if (ones.size() != 0) {
        cout << ones[0] << '\n';
      }
    } else if (solve == 2) {
      cout << two[0] << " " << two[1] << '\n';
    } else {
      for (int i = 0; i < solve; i++) {
        cout << ones[i] << " ";
      }
      cout << '\n';
    }
  }
  return 0;
}
