#include <bits/stdc++.h>
using namespace std;

#define MX 205
#define MP 10000005
int x[MX];
vector<int> v;
vector<int> g[MX];
bool vis[MX];
int lnk[MX];
bool f[MP] = {1, 1};

int dfs(int u) {
	for(auto v : g[u]) {
		if(vis[v]) continue;
		vis[v] = true;
		if(lnk[v] < 0 || dfs(lnk[v])) {
			lnk[v] = u;
			return 1;
		}
	}
	return 0;
}

int main() {
	for(int i = 2; i < MP; i++) {
		if(f[i]) continue;
		for(int j = i + i; j < MP; j += i) f[j] = 1;
	} f[2] = 1;
	int n; scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%d", x + i);
	for(int i = 0; i < n; i++) {
		if(x[i] + 1 != x[i + 1]) v.push_back(x[i]);
		if(!i || x[i] - 1 != x[i - 1]) v.push_back(x[i] - 1);
	}
	for(int i = 0; i < v.size(); i++)
		for(int j = 0; j < v.size(); j++)
			if(!f[abs(v[i] - v[j])]) g[i].push_back(j);
	int res = 0;
memset(lnk, 0xff, sizeof lnk);
	for(int i = 0; i < v.size(); i++) {
		if(v[i] & 1) continue;
		memset(vis, 0, sizeof vis);
		res += dfs(i);
	}
	int c[2] = {0};
	for(auto u : v) c[u & 1]++;
	c[0] -= res; c[1] -= res;
	res += c[0] / 2 * 2; res += c[1] / 2 * 2;
	c[0] &= 1; c[1] &= 1;
	if(c[0] || c[1]) res += 3;
	printf("%d\n", res);
	return 0;
}
### Prompt

Generate a cpp solution to the following problem:

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 <bits/stdc++.h>
using namespace std;

#define MX 205
#define MP 10000005
int x[MX];
vector<int> v;
vector<int> g[MX];
bool vis[MX];
int lnk[MX];
bool f[MP] = {1, 1};

int dfs(int u) {
	for(auto v : g[u]) {
		if(vis[v]) continue;
		vis[v] = true;
		if(lnk[v] < 0 || dfs(lnk[v])) {
			lnk[v] = u;
			return 1;
		}
	}
	return 0;
}

int main() {
	for(int i = 2; i < MP; i++) {
		if(f[i]) continue;
		for(int j = i + i; j < MP; j += i) f[j] = 1;
	} f[2] = 1;
	int n; scanf("%d", &n);
	for(int i = 0; i < n; i++) scanf("%d", x + i);
	for(int i = 0; i < n; i++) {
		if(x[i] + 1 != x[i + 1]) v.push_back(x[i]);
		if(!i || x[i] - 1 != x[i - 1]) v.push_back(x[i] - 1);
	}
	for(int i = 0; i < v.size(); i++)
		for(int j = 0; j < v.size(); j++)
			if(!f[abs(v[i] - v[j])]) g[i].push_back(j);
	int res = 0;
memset(lnk, 0xff, sizeof lnk);
	for(int i = 0; i < v.size(); i++) {
		if(v[i] & 1) continue;
		memset(vis, 0, sizeof vis);
		res += dfs(i);
	}
	int c[2] = {0};
	for(auto u : v) c[u & 1]++;
	c[0] -= res; c[1] -= res;
	res += c[0] / 2 * 2; res += c[1] / 2 * 2;
	c[0] &= 1; c[1] &= 1;
	if(c[0] || c[1]) res += 3;
	printf("%d\n", res);
	return 0;
}
```