#include <bits/stdc++.h>
using namespace std;
const int N = 400 + 10;
const int M = N * N;
const int P = 20000 + 10;
const int INF = 100;
struct Edge {
  int to, c;
  Edge *pre, *rev;
} edgeBuffer[M], *totEdges = edgeBuffer, *last[N], *from[N];
int notPrime[P];
int a[N];
int n;
int vis[N];
vector<int> ans[N];
void makePrimeTable() {
  for (int i = 2; i < P; ++i) {
    if (!notPrime[i]) {
      for (int j = i + i; j < P; j += i) {
        notPrime[j] = 1;
      }
    }
  }
}
Edge *newEdge(int u, int v, int c) {
  Edge *e = totEdges++;
  e->to = v;
  e->c = c;
  e->pre = last[u];
  last[u] = e;
  return e;
}
void addEdge(int u, int v, int c) {
  Edge *p = newEdge(u, v, c), *q = newEdge(v, u, 0);
  p->rev = q;
  q->rev = p;
}
int bfs(int s, int t) {
  static queue<int> que;
  static int vis[N];
  memset(vis, 0, sizeof vis);
  que.push(s);
  vis[s] = 1;
  for (; !que.empty(); que.pop()) {
    static int u, v;
    u = que.front();
    for (Edge *e = last[u]; e != NULL; e = e->pre) {
      if (e->c == 0) {
        continue;
      }
      v = e->to;
      if (!vis[v]) {
        que.push(v);
        vis[v] = 1;
        from[v] = e;
      }
    }
  }
  return vis[t];
}
int maxFlow(int s, int t) {
  int ret = 0;
  while (bfs(s, t)) {
    int f = INF;
    for (int u = t; u != s; u = from[u]->rev->to) {
      f = min(f, from[u]->c);
    }
    ret += f;
    for (int u = t; u != s; u = from[u]->rev->to) {
      from[u]->c -= f;
      from[u]->rev->c += f;
    }
  }
  return ret;
}
int main() {
  makePrimeTable();
  cin >> n;
  int cntOdd = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int s = n, t = n + 1;
  for (int i = 0; i < n; ++i) {
    if (a[i] & 1) {
      ++cntOdd;
      addEdge(s, i, 2);
      for (int j = 0; j < n; ++j) {
        if (!notPrime[a[i] + a[j]]) {
          addEdge(i, j, 1);
        }
      }
    } else {
      addEdge(i, t, 2);
    }
  }
  if (cntOdd * 2 != n) {
    printf("Impossible\n");
    return 0;
  }
  if (maxFlow(s, t) != n) {
    printf("Impossible\n");
    return 0;
  }
  int tot = 0;
  for (int i = 0; i < n; ++i) {
    if ((a[i] & 1) && !vis[i]) {
      for (int x = i; !vis[x];) {
        vis[x] = 1;
        ans[tot].push_back(x);
        int y;
        for (Edge *e = last[x]; e != NULL; e = e->pre) {
          if (e->c == 0 && !vis[e->to]) {
            y = e->to;
            ans[tot].push_back(y);
            vis[y] = 1;
            break;
          }
        }
        for (Edge *e = last[y]; e != NULL; e = e->pre) {
          if (e->c > 0 && e->to != x) {
            x = e->to;
            break;
          }
        }
      }
      ++tot;
    }
  }
  printf("%d\n", tot);
  for (int i = 0; i < tot; ++i) {
    printf("%d", (int)ans[i].size());
    for (int j = 0; j < (int)ans[i].size(); ++j) {
      printf(" %d", ans[i][j] + 1);
    }
    printf("\n");
  }
  return 0;
}
