#include <bits/stdc++.h>
using namespace std;
const int inft = 1000000009;
const int MAXM = 1000006;
const int MAXN = 505;
vector<int> V[MAXN];
int c, d;
int M[MAXN];
int MT[MAXN];
bool odw[MAXN];
queue<int> Q;
inline bool dfs(int u) {
  odw[u] = 1;
  Q.push(u);
  for (typeof((V[u]).begin()) it = (V[u]).begin(); it != (V[u]).end(); ++it)
    if (MT[u] != *it)
      if ((M[*it] == -1) || (!odw[M[*it]] && dfs(M[*it]))) {
        M[u] = *it;
        M[*it] = u;
        return 1;
      }
  return 0;
}
int matching() {
  for (int i = 0; i < (c); ++i) odw[i] = 0;
  for (int i = 0; i < (c + d); ++i) M[i] = -1;
  bool czy = 1;
  while (czy) {
    for (czy = 0; !Q.empty(); Q.pop()) odw[Q.front()] = 0;
    for (int i = 0; i < (c); ++i)
      if (M[i] == -1 && !odw[i]) czy |= dfs(i);
  }
  int ret = 0;
  for (int i = 0; i < (c); ++i)
    if (M[i] != -1) ++ret;
  return ret;
}
vector<pair<int, int> > A, B;
bool prime[MAXM];
void solve() {
  for (int i = 0; i < (MAXM); ++i)
    if (i > 1)
      if (!prime[i]) {
        for (int j = 2 * i; j < MAXM; j += i) prime[j] = true;
      }
  int n;
  scanf("%d", &n);
  for (int i = 0; i < (n); ++i) {
    int a;
    scanf("%d", &a);
    if (a % 2)
      A.push_back(pair<int, int>(a, i));
    else
      B.push_back(pair<int, int>(a, i));
  }
  c = A.size();
  d = B.size();
  for (int i = 0; i < (c); ++i)
    for (int j = 0; j < (d); ++j)
      if (!prime[A[i].first + B[j].first]) {
        V[i].push_back(c + j);
      }
  for (int i = 0; i < (n); ++i) MT[i] = -1;
  int ans = matching();
  for (int i = 0; i < (n); ++i) MT[i] = M[i];
  if (2 * ans != n) {
    printf("Impossible\n");
    return;
  }
  ans = matching();
  if (2 * ans != n) {
    printf("Impossible\n");
    return;
  }
  vector<int> C[MAXN];
  bool vis[MAXN];
  for (int i = 0; i < (MAXN); ++i) vis[i] = false;
  int nr = 0;
  for (int i = 0; i < (c); ++i)
    if (!vis[i]) {
      int tam = M[i], tu = MT[tam];
      vis[i] = true;
      vis[tu] = true;
      C[nr].push_back(i);
      C[nr].push_back(tam);
      C[nr].push_back(tu);
      while (tu != i) {
        tam = M[tu];
        tu = MT[tam];
        vis[i] = true;
        vis[tu] = true;
        C[nr].push_back(tam);
        C[nr].push_back(tu);
      }
      C[nr].pop_back();
      nr++;
    }
  printf("%d\n", nr);
  for (int i = 0; i < (nr); ++i) {
    printf("%d ", C[i].size());
    for (typeof((C[i]).begin()) it = (C[i]).begin(); it != (C[i]).end(); ++it) {
      if (*it < c)
        printf("%d ", A[*it].second + 1);
      else
        printf("%d ", B[*it - c].second + 1);
    }
    puts("");
  }
}
int main() {
  int t = 1;
  for (int i = 0; i < (t); ++i) solve();
  return 0;
}
