#include <bits/stdc++.h>
using namespace std;
int n;
struct EdmondsKarp {
  struct Edge {
    int dest;
    long long int cap;
    long long int flow;
    int back;
  };
  EdmondsKarp(int n) : G(n) {}
  void addEdge(int src, int dest, long long int cap) {
    if (src == dest) return;
    Edge e1 = {dest, cap, 0, (int)G[dest].size()};
    Edge e2 = {src, 0, 0, (int)G[src].size()};
    G[src].push_back(e1);
    G[dest].push_back(e2);
  }
  long long int maxFlow(int s, int t) {
    long long int ret = 0;
    vector<pair<int, int>> parent;
    while (true) {
      parent.clear();
      parent.resize(G.size(), pair<int, int>(-1, -1));
      queue<int> Q;
      Q.push(s);
      parent[s] = pair<int, int>(s, -1);
      while (!Q.empty()) {
        int v = Q.front();
        Q.pop();
        if (v == t) break;
        for (int i = 0; i < G[v].size(); ++i) {
          if (G[v][i].flow == G[v][i].cap) continue;
          int x = G[v][i].dest;
          if (parent[x].first != -1) continue;
          parent[x] = pair<int, int>(v, i);
          Q.push(x);
        }
      }
      if (parent[t].first == -1) break;
      long long int a = -1;
      int v = t;
      while (v != s) {
        pair<int, int> p = parent[v];
        long long int rem =
            G[p.first][p.second].cap - G[p.first][p.second].flow;
        if (a < 0 || rem < a) a = rem;
        v = p.first;
      }
      ret += a;
      v = t;
      while (v != s) {
        pair<int, int> p = parent[v];
        G[p.first][p.second].flow += a;
        G[v][G[p.first][p.second].back].flow -= a;
        v = p.first;
      }
    }
    return ret;
  }
  vector<vector<Edge>> G;
};
bool nonprime[30000];
int f[250];
vector<int> G2[250];
bool fund[250];
int main() {
  nonprime[0] = true;
  nonprime[1] = true;
  for (int i = 2; i < 30000; ++i) {
    for (int x = 2 * i; x < 30000; x += i) {
      nonprime[x] = true;
    }
  }
  cin.sync_with_stdio(false);
  cin >> n;
  EdmondsKarp ek(n + 2);
  for (int i = 0; i < n; ++i) {
    cin >> f[i];
    if (f[i] & 1) {
      ek.addEdge(n, i, 2);
    } else {
      ek.addEdge(i, n + 1, 2);
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (!(f[i] & 1)) continue;
      if (!nonprime[f[i] + f[j]]) {
        ek.addEdge(i, j, 1);
      }
    }
  }
  int flow = ek.maxFlow(n, n + 1);
  if (flow != n) {
    cout << "Impossible\n";
    return 0;
  }
  for (int i = 0; i < n; ++i) {
    if (!(f[i] & 1)) continue;
    for (EdmondsKarp::Edge e : ek.G[i]) {
      if (e.cap <= 0 || e.flow != 1) continue;
      G2[i].push_back(e.dest);
      G2[e.dest].push_back(i);
    }
  }
  vector<vector<int>> cycs;
  for (int i = 0; i < n; ++i) {
    if (fund[i]) continue;
    int x = i;
    vector<int> cyc;
    cyc.push_back(x);
    int p = x;
    fund[p] = true;
    x = G2[p][0];
    while (!fund[x]) {
      cyc.push_back(x);
      if (G2[x][0] == p) {
        p = x;
        x = G2[x][1];
      } else {
        p = x;
        x = G2[x][0];
      }
      fund[p] = true;
    }
    cycs.push_back(cyc);
  }
  cout << cycs.size() << '\n';
  for (auto cyc : cycs) {
    cout << cyc.size();
    for (int s : cyc) {
      cout << ' ' << s + 1;
    }
    cout << '\n';
  }
  return 0;
}
