#include <bits/stdc++.h>
using namespace std;
int main() {
  int prime[10000], k = 1, j = 1, n, N[10000], count = 0;
  prime[1] = 2;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> N[i];
  for (int N = 2; N < 1000000; N++) {
    while (j <= k) {
      if (N % prime[j] == 0)
        goto No;
      else
        j++;
    }
    prime[j] = N;
    k = j;
  No:
    j = 1;
  }
  for (int i = 1; i < k + 1; i++) cout << prime[i] << " ";
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= 1000000; j++) {
      if (N[i] == prime[j]) count++;
    }
  }
  cout << count << endl;
  return 0;
}
