#include <bits/stdc++.h>
using namespace std;
const int block_size = 320;
const long long mod = 1e9 + 7;
const long double eps = 1e-9;
const int inf = mod;
const double PI = atan(1) * 4;
template <typename T>
inline int sign(const T &a) {
  if (a < 0) return -1;
  if (a > 0) return 1;
  return 0;
}
template <typename T>
inline void in(T &x) {
  x = 0;
  T f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
struct edge {
  int from, to, cap;
};
const int maxn = 300, source = 250, sink = 251;
vector<int> g[maxn];
int val[maxn], n;
edge e[100010];
bool isp(int x) {
  if (x <= 1) return false;
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
void addEdge(int u, int v, int cap) {
  static int cnt = 0;
  int cur = cnt;
  e[cur] = {u, v, cap};
  g[u].push_back(cur);
  e[cur ^ 1] = {v, u, 0};
  g[v].push_back(cur ^ 1);
  cnt += 2;
}
void build() {
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> val[i];
  for (long long i = 0; i < n; i++) {
    if (val[i] % 2 == 0) {
      addEdge(source, i, 2);
    } else {
      addEdge(i, sink, 2);
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (val[i] % 2 == 0 && val[j] % 2 == 1) {
        if (isp(val[i] + val[j])) {
          addEdge(i, j, 1);
        }
      }
    }
  }
}
namespace maxFlow {
int lvl[maxn], cur[maxn];
bool bfs(int start = source) {
  memset(lvl, -1, sizeof(lvl));
  memset(cur, 0, sizeof(cur));
  lvl[start] = 0;
  queue<int> q;
  q.push(start);
  while (((int)q.size())) {
    int f = q.front();
    q.pop();
    for (auto curEdge : g[f]) {
      auto &E = e[curEdge];
      if (E.cap) {
        if (lvl[E.to] == -1) {
          lvl[E.to] = lvl[f] + 1;
          q.push(E.to);
        }
      }
    }
  }
  return lvl[sink] != -1;
}
int dfs(int curNode, int curCap) {
  if (!curCap || curNode == sink) return curCap;
  int ans = 0;
  for (int &i = cur[curNode]; i < ((int)g[curNode].size()); i++) {
    int curEdge = g[curNode][i];
    if (lvl[e[curEdge].to] > lvl[curNode]) {
      int delta = dfs(e[curEdge].to, min(e[curEdge].cap, curCap));
      ans += delta;
      curCap -= delta;
      e[curEdge].cap -= delta;
      e[curEdge ^ 1].cap += delta;
      if (!curCap) break;
    }
  }
  return ans;
}
void dinic() {
  while (bfs()) {
    (dfs(source, inf));
  }
}
}  // namespace maxFlow
vector<int> newGraph[maxn];
namespace finish {
bool vis[maxn];
void dfs(int cur, vector<int> &v) {
  v.push_back(cur);
  if (!vis[newGraph[cur][0]]) {
    vis[newGraph[cur][0]] = 1;
    dfs(newGraph[cur][0], v);
  } else if (!vis[newGraph[cur][1]]) {
    vis[newGraph[cur][1]] = 1;
    dfs(newGraph[cur][1], v);
  }
}
void finish() {
  for (long long i = 0; i < maxn; i++) {
    for (auto curEdge : g[i]) {
      if (e[curEdge].from == source || e[curEdge].to == sink) {
        if (e[curEdge].cap != 0) {
          cout << "Impossible" << endl;
          exit(0);
          ;
        }
      }
    }
  }
  for (long long i = 0; i < 100010; i++) {
    if (val[e[i].from] != 0 && val[e[i].to] != 0 && val[e[i].from] % 2 == 0 &&
        val[e[i].to] % 2 == 1 && e[i].cap == 0) {
      newGraph[e[i].from].push_back(e[i].to);
      newGraph[e[i].to].push_back(e[i].from);
    }
  }
  vector<vector<int>> ans;
  for (long long i = 0; i < n; i++) {
    if (!vis[i]) {
      assert(((int)newGraph[i].size()) == 2);
      vis[i] = 1;
      vector<int> temp;
      dfs(i, temp);
      ans.push_back(temp);
    }
  }
  cout << ((int)ans.size()) << endl;
  for (auto &v : ans) {
    cout << ((int)v.size()) << ' ';
    for (auto ele : v) {
      cout << 1 + ele << ' ';
    }
    cout << endl;
  }
}
}  // namespace finish
int main() {
  build();
  maxFlow::dinic();
  finish::finish();
  return 0;
}
