#include <bits/stdc++.h>
using namespace std;
struct edge {
  int index, w, pre, kt;
};
int b[50000], a[50000], flg[50000], dis[50000], tot, f[50000], flow, n,
    w[500][500], w1[500][500], pre[500];
vector<edge> c[50000];
vector<vector<int> > ans;
void dog() {
  for (int i = 1; i <= 20000; i++) b[i] = 0;
  b[1] = 1;
  for (int i = 2; i <= 20000; i++)
    if (b[i] == 0)
      for (int j = i + i; j <= 20000; j += i) b[j] = 1;
}
void addedge(int index1, int index2, int w) {
  edge e1, e2;
  e1.index = index2;
  e1.w = w;
  e1.pre = c[index2].size();
  e1.kt = 1;
  c[index1].push_back(e1);
  e2.index = index1;
  e2.w = 0;
  e2.pre = c[index1].size() - 1;
  e2.kt = -1;
  c[index2].push_back(e2);
}
bool bfs() {
  int t1, t2;
  for (int i = 1; i <= tot; i++) dis[i] = 100000000;
  dis[1] = 0;
  t1 = 0;
  t2 = 1;
  f[1] = 1;
  while (true) {
    t1++;
    if (t1 > t2) break;
    int index = f[t1];
    if (index == 2) break;
    for (int i = 1; i <= 2 * n + 2; i++) {
      if (dis[i] != 100000000 || w[index][i] <= 0) continue;
      f[++t2] = i;
      dis[i] = dis[index] + 1;
      pre[i] = index;
    }
  }
  if (dis[2] == 100000000) return false;
  return true;
}
int pig(int index) {
  if (index == 2) return 1;
  if (index == 1) return 2;
  return (index > n + 2 ? index - n : index + n);
}
void findpath() {
  int index;
  index = 2;
  while (index != 1) {
    w[pre[index]][index]--;
    w[index][pre[index]]++;
    int pt1, pt2;
    w[pig(index)][pig(pre[index])]--;
    w[pig(pre[index])][pig(index)]++;
    index = pre[index];
  }
}
void dfs2(int index, vector<int>& p) {
  flg[index] = 1;
  p.push_back(index);
  for (int i = 1; i <= n; i++)
    if (w[index + 2][i + n + 2] == 0 && flg[i] == 0 &&
        w1[index + 2][i + n + 2] == 1) {
      dfs2(i, p);
    }
}
void output() {
  ans.clear();
  for (int i = 1; i <= 2 * n + 2; i++) flg[i] = 0;
  for (int i = 1; i <= n; i++) {
    if (flg[i] == 1) continue;
    vector<int> tmp;
    tmp.clear();
    ans.push_back(tmp);
    dfs2(i, ans[ans.size() - 1]);
  }
  printf("%d\n", ans.size());
  for (int i = 0; i < ans.size(); i++) {
    printf("%d ", ans[i].size());
    for (int j = 0; j < ans[i].size(); j++) printf("%d ", ans[i][j]);
    printf("\n");
  }
}
void work() {
  int i;
  for (i = 1; i <= n; i++) {
    if (!bfs()) break;
    findpath();
  }
  if (i != n + 1) {
    printf("Impossible\n");
    return;
  }
  output();
}
void build() {
  for (int i = 1; i <= n * n + 2 + n; i++) c[i].clear();
  for (int i = 1; i <= 2 * n + 2; i++)
    for (int j = 1; j <= 2 * n + 2; j++) w[i][j] = 0;
  for (int i = 1; i <= n; i++) {
    w[1][i + 2] = 2;
    w[i + n + 2][2] = 2;
  }
  for (int i = 1; i <= n; i++) {
    addedge(1, i + 2, 2);
    addedge(i + n + 2, 2, 2);
  }
  tot = 2 * n + 2;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      if (b[a[i] + a[j]] == 1) continue;
      w[i + 2][j + n + 2] = 1;
      w[j + 2][i + n + 2] = 1;
      addedge(i + 2, j + n + 2, 1);
      addedge(j + 2, i + n + 2, 1);
    }
  for (int i = 1; i <= 2 * n + 2; i++)
    for (int j = 1; j <= 2 * n + 2; j++) w1[i][j] = w[i][j];
}
int main() {
  dog();
  while (scanf("%d", &n) != EOF) {
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    build();
    work();
  }
  return 0;
}
