#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int a[509], n;
struct node {
  int id, num;
  bool operator<(const node &rhs) const {
    if (num % 2 != rhs.num % 2) {
      return num % 2 < rhs.num % 2;
    } else {
      return id < rhs.id;
    }
  }
} p[509];
struct Edge {
  int v, cap, next;
} edge[5000009];
int head[509], cur[509], d[509], gap[509], Q[509], pre[509];
int src, des, tot;
void addedge(int u, int v, int cap) {
  edge[tot].v = v;
  edge[tot].cap = cap;
  edge[tot].next = head[u];
  head[u] = tot++;
  edge[tot].v = u;
  edge[tot].cap = 0;
  edge[tot].next = head[v];
  head[v] = tot++;
}
void init() {
  memset(head, -1, sizeof(head));
  tot = 0;
}
void bfs() {
  int h = 0, t = 0;
  for (int i = 0; i < n; i++) {
    d[i] = INF;
    gap[i] = 0;
  }
  Q[t++] = des;
  d[des] = 0;
  gap[0] = 1;
  while (t != h) {
    int u = Q[h++];
    for (int e = head[u]; e != -1; e = edge[e].next) {
      if (!edge[e ^ 1].cap || d[edge[e].v] < INF) continue;
      d[edge[e].v] = d[u] + 1;
      gap[d[edge[e].v]]++;
      Q[t++] = edge[e].v;
    }
  }
}
int sap() {
  bfs();
  int u, flow = 0;
  for (int i = 0; i < n; i++) cur[i] = head[i];
  u = src;
  while (d[src] < n) {
    if (u == des) {
      int augflow = INF;
      for (int v = src; v != des; v = edge[cur[v]].v) {
        augflow = min(augflow, edge[cur[v]].cap);
      }
      for (int v = src; v != des; v = edge[cur[v]].v) {
        edge[cur[v]].cap -= augflow;
        edge[cur[v] ^ 1].cap += augflow;
      }
      flow += augflow;
      u = src;
    }
    int e;
    for (e = cur[u]; e != -1; e = edge[e].next) {
      if (edge[e].cap > 0 && d[u] == d[edge[e].v] + 1) break;
    }
    if (e != -1) {
      cur[u] = e;
      pre[edge[e].v] = e ^ 1;
      u = edge[e].v;
    } else {
      gap[d[u]]--;
      if (gap[d[u]] == 0) break;
      cur[u] = head[u];
      int minh = n;
      for (int e = head[u]; e != -1; e = edge[e].next) {
        if (edge[e].cap) {
          minh = min(minh, d[edge[e].v]);
        }
      }
      d[u] = minh + 1;
      gap[d[u]]++;
      if (u != src) u = edge[pre[u]].v;
    }
  }
  return flow;
}
bool check(int x) {
  for (int i = 2; i * i <= x; i++) {
    if (x % i == 0) return 0;
  }
  return 1;
}
vector<int> G[509], ans[509];
int vis[509], cnt;
void DFS(int u) {
  vis[u] = 1;
  ans[cnt].push_back(u);
  for (int i = 0; i < (int)G[u].size(); i++) {
    int v = G[u][i];
    if (!vis[v]) {
      DFS(v);
    }
  }
}
int main() {
  int N;
  cin >> N;
  int odd = 0, eve = 0;
  for (int i = 1; i <= N; i++) {
    cin >> a[i];
    if (a[i] & 1)
      odd++;
    else
      eve++;
    p[i].num = a[i];
    p[i].id = i;
  }
  if (odd != eve) {
    puts("Impossible");
    return 0;
  } else {
    src = 0;
    des = N + 1;
    n = des + 1;
    memset(head, -1, sizeof(head));
    tot = 0;
    sort(p + 1, p + 1 + N);
    for (int i = 1; i <= N / 2; i++) {
      for (int j = N / 2 + 1; j <= N; j++) {
        if (check(p[i].num + p[j].num)) {
          addedge(i, j, 1);
        }
      }
    }
    for (int i = 1; i <= N / 2; i++) addedge(src, i, 2);
    for (int i = N / 2 + 1; i <= N; i++) addedge(i, des, 2);
    int flow = sap();
    if (flow != N) {
      puts("Impossible");
    } else {
      for (int i = N / 2 + 1; i <= N; i++) {
        for (int e = head[i]; e != -1; e = edge[e].next) {
          int v = edge[e].v;
          if (edge[e].cap) {
            if (v >= 1 && v <= N / 2) {
              G[p[i].id].push_back(p[v].id);
              G[p[v].id].push_back(p[i].id);
            }
          }
        }
      }
      cnt = 0;
      for (int i = 1; i <= N; i++) {
        if (!vis[i]) {
          DFS(i);
          cnt++;
        }
      }
      printf("%d\n", cnt);
      for (int i = 0; i < cnt; i++) {
        printf("%d", (int)ans[i].size());
        for (int j = 0; j < (int)ans[i].size(); j++) printf(" %d", ans[i][j]);
        puts("");
      }
    }
  }
  return 0;
}
