#include <bits/stdc++.h>
using namespace std;
int a, b[1009], vis[100009 * 20], w;
vector<int> v, mxv;
int main() {
  for (int i = 1; i <= 1000000 * 2; i++) vis[i] = 1;
  vis[0] = 0, vis[1] = 0;
  for (int i = 2; i <= 1000000; i++)
    if (vis[i])
      if (i * 1ll * i <= 1000000 * 2)
        for (int j = i * i; j <= 1000000 * 2; j += i) vis[j] = 0;
  cin >> a;
  int x = 0;
  for (int i = 1; i <= a; i++) {
    cin >> b[i];
    if (vis[b[i] + 1] == 1 and b[i] != 1) x = b[i];
    if (b[i] == 1) w++;
  }
  for (int i = 0; i < w; i++) v.push_back(1);
  if (x > 0 and w > 0) v.push_back(x);
  if (v.size() > mxv.size()) mxv = v;
  for (int i = 1; i <= a; i++) {
    for (int j = 1; j <= a; j++)
      if (i != j and vis[b[i] + b[j]] == 1) {
        if (2 > mxv.size()) {
          mxv.clear();
          mxv.push_back(b[i]);
          mxv.push_back(b[j]);
        }
      }
  }
  if (mxv.size() == 0) mxv.push_back(b[1]);
  cout << mxv.size() << endl;
  for (int i = 0; i < mxv.size(); i++) cout << mxv[i] << ' ';
  return 0;
}
