#include<bits/stdc++.h>
using namespace std;
const int MAXN = 205;
const int MAXM = 10000005;
int n, x[MAXN], f[MAXM], p[MAXM], cnt, match[MAXN], w[MAXN][MAXN];
bool ip[MAXM];
void pre(int N) {
	for(int i = 2; i <= N; ++i) {
		if(!ip[i]) p[++cnt] = i;
		for(int j = 1; j <= cnt && p[j]*i <= N; ++j) {
			ip[p[j]*i] = 1;
			if(i % p[j] == 0) break;
		}
	}
}
bool vis[MAXN];
bool dfs(int u) {
	for(int v = 1; v <= n; ++v)
		if(w[u][v] && !vis[v]) {
			vis[v] = 1;
			if(!match[v] || dfs(match[v])) {
				match[v] = u;
				match[u] = v;
				return 1;
			}
		}
	return 0;
}
int maxmatch() {
	int re = 0;
	for(int i = 1; i <= n; ++i)
		if(x[i]&1) {
			memset(vis,0,sizeof vis);
			re += dfs(i);
		}
	return re;
}
int main () {
	scanf("%d", &n);
	for(int i = 1,y; i <= n; ++i) scanf("%d", &y), f[y] = 1;
	for(int i = 10000001; i >= 1; --i) f[i] ^= f[i-1];
	n = 0;
	for(int i = 1; i <= 10000001; ++i) if(f[i]) x[++n] = i;
	pre(x[n]); ip[2] = ip[1] = 1;
	for(int i = 1; i <= n; ++i)
		for(int j = i+1; j <= n; ++j)
			if(!ip[x[j]-x[i]])
				w[i][j] = w[j][i] = 1;
	int ans = maxmatch();
	int c1 = 0, c2 = 0;
	for(int i = 1; i <= n; ++i)
		if(!match[i]) (x[i] & 1) ? ++c1 : ++c2;
	ans += 2*(c1/2) + 2*(c2/2) + (c1&1)*3;
	printf("%d\n", ans);
}

### Prompt

Create a solution in Cpp for 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;
const int MAXN = 205;
const int MAXM = 10000005;
int n, x[MAXN], f[MAXM], p[MAXM], cnt, match[MAXN], w[MAXN][MAXN];
bool ip[MAXM];
void pre(int N) {
	for(int i = 2; i <= N; ++i) {
		if(!ip[i]) p[++cnt] = i;
		for(int j = 1; j <= cnt && p[j]*i <= N; ++j) {
			ip[p[j]*i] = 1;
			if(i % p[j] == 0) break;
		}
	}
}
bool vis[MAXN];
bool dfs(int u) {
	for(int v = 1; v <= n; ++v)
		if(w[u][v] && !vis[v]) {
			vis[v] = 1;
			if(!match[v] || dfs(match[v])) {
				match[v] = u;
				match[u] = v;
				return 1;
			}
		}
	return 0;
}
int maxmatch() {
	int re = 0;
	for(int i = 1; i <= n; ++i)
		if(x[i]&1) {
			memset(vis,0,sizeof vis);
			re += dfs(i);
		}
	return re;
}
int main () {
	scanf("%d", &n);
	for(int i = 1,y; i <= n; ++i) scanf("%d", &y), f[y] = 1;
	for(int i = 10000001; i >= 1; --i) f[i] ^= f[i-1];
	n = 0;
	for(int i = 1; i <= 10000001; ++i) if(f[i]) x[++n] = i;
	pre(x[n]); ip[2] = ip[1] = 1;
	for(int i = 1; i <= n; ++i)
		for(int j = i+1; j <= n; ++j)
			if(!ip[x[j]-x[i]])
				w[i][j] = w[j][i] = 1;
	int ans = maxmatch();
	int c1 = 0, c2 = 0;
	for(int i = 1; i <= n; ++i)
		if(!match[i]) (x[i] & 1) ? ++c1 : ++c2;
	ans += 2*(c1/2) + 2*(c2/2) + (c1&1)*3;
	printf("%d\n", ans);
}

```