#include <bits/stdc++.h>
using namespace std;
template <class T>
struct isap {
  isap(){};
  int cnt, u, v, e, s, t, d, N[50004], now[50004], dpth[50004], vtn[50004],
      pre[50004];
  int vt[800003], ne[800003];
  T cap[800003];
  T maxflow, tflow;
  void init(int _s, int _t, int _d) {
    s = _s;
    t = _t;
    d = _d;
    cnt = 2;
    maxflow = 0;
    memset(N, 0, sizeof(N));
  };
  void link(int u, int v, T c) {
    vt[cnt] = v;
    ne[cnt] = N[u];
    cap[cnt] = c;
    now[u] = N[u] = cnt++;
  }
  void build(int u, int v, T c) {
    link(u, v, c);
    link(v, u, 0);
  }
  T run() {
    memset(dpth, 0, sizeof(dpth));
    memset(vtn, 0, sizeof(vtn));
    vtn[0] = d;
    for (u = s; dpth[s] < d;) {
      if (u == t) {
        for (v = s, tflow = (0x3f3f3f3f); v != t;
             tflow = min(cap[now[v]], tflow), v = vt[now[v]])
          ;
        for (v = s; v != t; v = vt[now[v]]) {
          cap[now[v]] -= tflow;
          cap[now[v] ^ 1] += tflow;
        }
        u = s;
        maxflow += tflow;
      } else {
        for (e = now[u]; e; e = ne[e])
          if (cap[e] > 0 && dpth[vt[e]] + 1 == dpth[u]) break;
        if (e) {
          now[u] = e;
          pre[vt[e]] = u;
          u = vt[e];
        } else {
          if (--vtn[dpth[u]] == 0) break;
          for (e = N[u], v = d; e; e = ne[e])
            if (cap[e] > 0) v = min(v, dpth[vt[e]]);
          dpth[u] = v + 1;
          ++vtn[dpth[u]];
          now[u] = N[u];
          if (u != s) u = pre[u];
        }
      }
    }
    return maxflow;
  }
};
isap<int> flow;
bool ispri(int n) {
  for (int i = 2; i * i <= n; ++i)
    if (n % i == 0) return false;
  return true;
}
int main() {
  int n, a[50004];
  bool vis[50004];
  int od, ev;
  vector<vector<int> > ans;
  vector<int> res;
  scanf("%d", &n);
  flow.init(0, n + 1, n + 2);
  od = ev = 0;
  memset(vis, 0, sizeof(vis));
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a[i]);
    if (a[i] & 1) {
      flow.build(flow.s, i, 2);
      ++od;
    } else {
      flow.build(i, flow.t, 2);
      ++ev;
    }
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if ((a[i] & 1) && !(a[j] & 1) && ispri(a[i] + a[j])) flow.build(i, j, 1);
  if (od == ev && flow.run() == n) {
    int v, e, te, pre;
    bool end;
    for (e = flow.N[flow.s]; e; e = flow.ne[e])
      if (!vis[flow.vt[e]]) {
        v = flow.vt[e];
        res.push_back(v);
        vis[v] = true;
        pre = 0;
        end = false;
        while (!end) {
          for (te = flow.N[v]; te; te = flow.ne[te])
            if (flow.vt[te] != pre && !flow.cap[te]) {
              res.push_back(flow.vt[te]);
              pre = v;
              v = flow.vt[te];
              break;
            }
          for (te = flow.N[v]; te; te = flow.ne[te])
            if (flow.vt[te] != pre && flow.cap[te]) {
              if (flow.vt[te] == res.front()) {
                end = true;
                break;
              }
              res.push_back(flow.vt[te]);
              pre = v;
              v = flow.vt[te];
              vis[v] = true;
              break;
            }
        }
        ans.push_back(res);
        res.clear();
      }
    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");
    }
  } else
    printf("Impossible\n");
}
