#include <bits/stdc++.h>
using namespace std;
const int64_t M1 = 998244353;
const int64_t M2 = 1000000007;
mt19937 rng((uint64_t)chrono::steady_clock::now().time_since_epoch().count());
int64_t match[410];
int64_t vis[410];
vector<int64_t> node[410];
int64_t p[40010];
int64_t n;
bool dfs(int64_t u) {
  if (u < 0 || vis[u]) return false;
  vis[u] = 1;
  for (int64_t v : node[u])
    if ((match[u + n] != v - n) && (match[v] == -1 || dfs(match[v]))) {
      match[v] = u;
      return true;
    }
  return false;
}
void solve() {
  p[0] = p[1] = 1;
  for (int64_t i = 2; i * i <= 40009; i++)
    if (!p[i])
      for (int64_t j = i + i; j <= 40009; j += i) p[j] = 1;
  cin >> n;
  vector<int64_t> a(n);
  for (int64_t i = 0; i < n; i++) cin >> a[i];
  for (int64_t i = 0; i < n; i++)
    for (int64_t j = 0; j < n; j++) {
      if (!p[a[i] + a[j]]) node[i].push_back(n + j);
    }
  memset(match, -1, sizeof(match));
  for (int64_t i = 0; i < n; i++) {
    memset(vis, 0, sizeof(vis));
    if (!dfs(i)) {
      cout << "Impossible\n";
      return;
    }
  }
  memset(vis, 0, sizeof(vis));
  vector<vector<int64_t>> tables;
  for (int64_t i = 0; i < n; i++) {
    if (!vis[i]) {
      vector<int64_t> cycle;
      cycle.push_back(i);
      vis[i] = 1;
      int64_t u = match[n + i];
      while (u != i) {
        vis[u] = 1;
        cycle.push_back(u);
        u = match[n + u];
      }
      tables.push_back(cycle);
    }
  }
  cout << (int64_t)tables.size() << "\n";
  for (auto cycle : tables) {
    cout << (int64_t)cycle.size() << " ";
    for (int64_t u : cycle) cout << u + 1 << " ";
    cout << "\n";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
