#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
int a[N];
int h[N];
int p[N];
void pre() {
  p[1] = 1;
  for (int i = 2; i < N; i++) {
    if (p[i] == 0) {
      for (int j = i + i; j < N; j += i) p[j] = 1;
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  pre();
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    h[a[i]]++;
  }
  int xx = -1, yy = -1;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (!p[a[i] + a[j]]) {
        xx = a[i], yy = a[j];
      }
    }
  }
  int px = -1;
  for (int i = 0; i < n; i++) {
    if (a[i] != 1 && !p[a[i] + 1]) {
      px = a[i];
    }
  }
  vector<int> yo;
  if (xx != -1)
    yo = {xx, yy};
  else
    yo = {a[0]};
  vector<int> vo;
  for (int j = 0; j < h[1]; j++) {
    vo.push_back(1);
  }
  if (px != -1) vo.push_back(px);
  if ((int)yo.size() < (int)vo.size()) swap(yo, vo);
  cout << (int)yo.size() << "\n";
  for (auto i : yo) cout << i << " ";
  return 0;
}
