#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int n, a[200];
vector<int> l;
vector<int> r;
bool ch[100000];
int s, t;
int e[202][202];
int f[202][202];
bool chk[202];
vector<int> v[202];
vector<vector<int> > ans;
bool flow(int x) {
  if (x == t) return true;
  chk[x] = true;
  for (int i = 0; i < n + 2; i++)
    if (e[x][i] && !chk[i]) {
      if (flow(i)) {
        e[x][i]--;
        f[x][i]++;
        e[i][x]++;
        f[i][x]--;
        return true;
      }
    }
  return false;
}
int nf() {
  int res = 0;
  while (true) {
    memset(chk, 0, sizeof chk);
    if (!flow(s)) return res;
    res++;
    while (flow(s)) res++;
  }
  return res;
}
void pdfs(int x, vector<int>& res) {
  res.push_back(x);
  chk[x] = true;
  for (int i = 0; i < v[x].size(); i++)
    if (!chk[v[x][i]]) {
      pdfs(v[x][i], res);
      return;
    }
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 2; i < 100000; i++)
    if (!ch[i]) {
      for (int j = i + i; j < 100000; j += i) ch[j] = true;
    }
  s = n, t = n + 1;
  for (int i = 0; i < n; i++) {
    if (a[i] % 2 == 0)
      l.push_back(i);
    else
      r.push_back(i);
  }
  for (int i = 0; i < l.size(); i++) e[s][l[i]] = 2;
  for (int i = 0; i < r.size(); i++) e[r[i]][t] = 2;
  for (int i = 0; i < l.size(); i++)
    for (int j = 0; j < r.size(); j++)
      if (!ch[a[l[i]] + a[r[j]]]) e[l[i]][r[j]] = 1;
  if (n % 2 || nf() != n) {
    printf("Impossible\n");
  } else {
    for (int i = 0; i < l.size(); i++) {
      for (int j = 0; j < n + 2; j++)
        if (f[l[i]][j] == 1) v[l[i]].push_back(j), v[j].push_back(l[i]);
    }
    memset(chk, 0, sizeof chk);
    for (int i = 0; i < l.size(); i++)
      if (!chk[l[i]]) {
        vector<int> res;
        pdfs(l[i], res);
        ans.push_back(res);
      }
    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] + 1);
      printf("\n");
    }
  }
  return 0;
}
