#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;

const int MAX_N = 205;

class Edge {
public:
  int nxt, to;
} e[MAX_N * MAX_N];

int head[MAX_N], cnt;
void addedge(int u, int v) {
  e[++cnt] = (Edge){head[u], v}, head[u] = cnt;
}

bool isprime(int x) {
  for (int i = 2; i * i <= x; ++i)
    if (x % i == 0) return false;
  return true;
}

int N, pos[MAX_N], tot, val[MAX_N], match[MAX_N];
map<int, bool> vis;
bool bad[MAX_N];

bool dfs(int x) {
  if (bad[x]) return false;
  bad[x] = 1;
  for (int i = head[x]; i; i = e[i].nxt)
    if (!match[e[i].to] || dfs(match[e[i].to])) {
      match[e[i].to] = x;
      return true;
    }
  return false;
}

int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) 
    scanf("%d", &pos[i]);
  pos[0] = -1;
  for (int i = 1; i <= N; ++i) {
    if (pos[i - 1] != pos[i] - 1) val[++tot] = pos[i];
    if (pos[i + 1] != pos[i] + 1) val[++tot] = pos[i] + 1;
  }
  
  int odd = 0, even = 0;
  
  for (int i = 1; i <= tot; ++i)
    if (val[i] & 1) {
      odd++;
      for (int j = 1; j <= tot; ++j)
	if (!(val[j] & 1) && abs(val[i] - val[j]) > 1 && isprime(abs(val[i] - val[j])))
	  addedge(i, j);
    } else {
      even++;
    }

  int num = 0;
  for (int i = 1; i <= tot; ++i) 
    if (val[i] & 1) {
      memset(bad, 0, sizeof bad);
      num += dfs(i);
    }

  printf("%d\n", num + ((odd - num) / 2 + (even - num) / 2) * 2 + (odd - num) % 2 * 3);
  return 0;
}

### Prompt

Please provide a cpp coded solution to the problem described below:

There are infinitely many cards, numbered 1, 2, 3, ... Initially, Cards x_1, x_2, ..., x_N are face up, and the others are face down.

Snuke can perform the following operation repeatedly:

* Select a prime p greater than or equal to 3. Then, select p consecutive cards and flip all of them.



Snuke's objective is to have all the cards face down. Find the minimum number of operations required to achieve the objective.

Constraints

* 1 ≤ N ≤ 100
* 1 ≤ x_1 < x_2 < ... < x_N ≤ 10^7

Input

Input is given from Standard Input in the following format:


N
x_1 x_2 ... x_N


Output

Print the minimum number of operations required to achieve the objective.

Examples

Input

2
4 5


Output

2


Input

9
1 2 3 4 5 6 7 8 9


Output

3


Input

2
1 10000000


Output

4

### Response

```cpp
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <map>
using namespace std;

const int MAX_N = 205;

class Edge {
public:
  int nxt, to;
} e[MAX_N * MAX_N];

int head[MAX_N], cnt;
void addedge(int u, int v) {
  e[++cnt] = (Edge){head[u], v}, head[u] = cnt;
}

bool isprime(int x) {
  for (int i = 2; i * i <= x; ++i)
    if (x % i == 0) return false;
  return true;
}

int N, pos[MAX_N], tot, val[MAX_N], match[MAX_N];
map<int, bool> vis;
bool bad[MAX_N];

bool dfs(int x) {
  if (bad[x]) return false;
  bad[x] = 1;
  for (int i = head[x]; i; i = e[i].nxt)
    if (!match[e[i].to] || dfs(match[e[i].to])) {
      match[e[i].to] = x;
      return true;
    }
  return false;
}

int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; ++i) 
    scanf("%d", &pos[i]);
  pos[0] = -1;
  for (int i = 1; i <= N; ++i) {
    if (pos[i - 1] != pos[i] - 1) val[++tot] = pos[i];
    if (pos[i + 1] != pos[i] + 1) val[++tot] = pos[i] + 1;
  }
  
  int odd = 0, even = 0;
  
  for (int i = 1; i <= tot; ++i)
    if (val[i] & 1) {
      odd++;
      for (int j = 1; j <= tot; ++j)
	if (!(val[j] & 1) && abs(val[i] - val[j]) > 1 && isprime(abs(val[i] - val[j])))
	  addedge(i, j);
    } else {
      even++;
    }

  int num = 0;
  for (int i = 1; i <= tot; ++i) 
    if (val[i] & 1) {
      memset(bad, 0, sizeof bad);
      num += dfs(i);
    }

  printf("%d\n", num + ((odd - num) / 2 + (even - num) / 2) * 2 + (odd - num) % 2 * 3);
  return 0;
}

```