#include <algorithm>
#include <cstring>
#include <cstdio>
int a[205],fst[205],match[205],p[1000000],tot=0;
bool u[10000005],vis[205];
struct Edge{int to,nxt;}e[10005];
void addedge(int x,int y){
	e[++tot].to=y;e[tot].nxt=fst[x];fst[x]=tot;
}
void init(int n){
	for (int i=2;i<=n;i++){
		if (!u[i]) p[++p[0]]=i;
		for (int j=1;j<=p[0] && i*p[j]<=n;j++){
			u[i*p[j]]=1;
			if (i%p[j]==0) break;
		}
	}
	u[0]=u[1]=u[2]=1;
}
bool dfs(int x){
	if (vis[x]) return 0;
	vis[x]=1;
	for (int i=fst[x];i;i=e[i].nxt){
		int y=e[i].to;
		if (!match[y] || dfs(match[y])){
			match[y]=x;
			return 1;
		}
	}
	return 0;
}
int main(){
	int n,m=0;
	scanf("%d\n",&n);
	for (int i=1;i<=n;i++){
		int x;scanf("%d",&x);
		if (a[m]==x) m--;else a[++m]=x;
		a[++m]=x+1;
	}
	init(a[m]-a[1]);
	for (int i=1;i<=m;i++)
	if (a[i]&1)
		for (int j=1;j<=m;j++)
		if (!u[abs(a[i]-a[j])]) addedge(i,j);
	int ans=0,cnt=0;
	for (int i=1;i<=m;i++)
	if (a[i]&1){
		memset(vis,0,sizeof vis);
		if (dfs(i)) ans++;else cnt++;
	}
	printf("%d\n",m-ans+(cnt&1));
}
### 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 <algorithm>
#include <cstring>
#include <cstdio>
int a[205],fst[205],match[205],p[1000000],tot=0;
bool u[10000005],vis[205];
struct Edge{int to,nxt;}e[10005];
void addedge(int x,int y){
	e[++tot].to=y;e[tot].nxt=fst[x];fst[x]=tot;
}
void init(int n){
	for (int i=2;i<=n;i++){
		if (!u[i]) p[++p[0]]=i;
		for (int j=1;j<=p[0] && i*p[j]<=n;j++){
			u[i*p[j]]=1;
			if (i%p[j]==0) break;
		}
	}
	u[0]=u[1]=u[2]=1;
}
bool dfs(int x){
	if (vis[x]) return 0;
	vis[x]=1;
	for (int i=fst[x];i;i=e[i].nxt){
		int y=e[i].to;
		if (!match[y] || dfs(match[y])){
			match[y]=x;
			return 1;
		}
	}
	return 0;
}
int main(){
	int n,m=0;
	scanf("%d\n",&n);
	for (int i=1;i<=n;i++){
		int x;scanf("%d",&x);
		if (a[m]==x) m--;else a[++m]=x;
		a[++m]=x+1;
	}
	init(a[m]-a[1]);
	for (int i=1;i<=m;i++)
	if (a[i]&1)
		for (int j=1;j<=m;j++)
		if (!u[abs(a[i]-a[j])]) addedge(i,j);
	int ans=0,cnt=0;
	for (int i=1;i<=m;i++)
	if (a[i]&1){
		memset(vis,0,sizeof vis);
		if (dfs(i)) ans++;else cnt++;
	}
	printf("%d\n",m-ans+(cnt&1));
}
```