#include<bits/stdc++.h>
int n,vs[107],xs[207],xp=0;
struct edge{
	int to,nx,v;
}e[100007];
int ep=2,e0[207],h[207],q[207],S,T;
bool bfs(){
	for(int i=1;i<=T;++i)h[i]=0;
	int ql=0,qr=0;
	h[q[++qr]=S]=1;
	while(ql!=qr){
		int w=q[++ql];
		if(w==T)return 1;
		for(int i=e0[w];i;i=e[i].nx)if(e[i].v){
			int u=e[i].to;
			if(!h[u])h[q[++qr]=u]=h[w]+1;
		}
	}
	return 0;
}
int dfs(int w,int f){
	if(w==T)return f;
	int c,used=0;
	for(int i=e0[w];i;i=e[i].nx)if(e[i].v){
		int u=e[i].to;
		if(h[u]!=h[w]+1)continue;
		c=dfs(u,std::min(e[i].v,f-used));
		e[i].v-=c;
		e[i^1].v+=c;
		used+=c;
		if(f==used)return f;
	}
	h[w]=0;
	return used;
}
bool isp(int x){
	if(x<0)x=-x;
	if((~x&1)||x<3)return 0;
	for(int i=3;i*i<=x;i+=2)if(x%i==0)return 0;
	return 1;
}
void ae(int a,int b){
	e[ep]=(edge){b,e0[a],1};e0[a]=ep++;
	e[ep]=(edge){a,e0[b],0};e0[b]=ep++;
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;++i)scanf("%d",vs+i);
	for(int i=0,j=0;i<n;i=j){
		for(++j;j<n&&vs[j]-vs[j-1]==1;++j);
		xs[++xp]=vs[i];
		xs[++xp]=vs[j-1]+1;
	}
	S=xp+1,T=xp+2;
	int co=0,ce;
	for(int i=1;i<=xp;++i){
		if(xs[i]&1){
			ae(S,i);
			++co;
			for(int j=1;j<=xp;++j)if((~xs[j]&1)&&isp(xs[j]-xs[i]))ae(i,j);
		}else ae(i,T);
	}
	int ans=0,c2;
	while(bfs())ans+=dfs(S,0x3f3f);
	ce=xp-co;
	co-=ans,ce-=ans;
	printf("%d\n",ans+ce+co+(co&1));
	return 0;
}
### Prompt

Construct a CPP code solution to the problem outlined:

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>
int n,vs[107],xs[207],xp=0;
struct edge{
	int to,nx,v;
}e[100007];
int ep=2,e0[207],h[207],q[207],S,T;
bool bfs(){
	for(int i=1;i<=T;++i)h[i]=0;
	int ql=0,qr=0;
	h[q[++qr]=S]=1;
	while(ql!=qr){
		int w=q[++ql];
		if(w==T)return 1;
		for(int i=e0[w];i;i=e[i].nx)if(e[i].v){
			int u=e[i].to;
			if(!h[u])h[q[++qr]=u]=h[w]+1;
		}
	}
	return 0;
}
int dfs(int w,int f){
	if(w==T)return f;
	int c,used=0;
	for(int i=e0[w];i;i=e[i].nx)if(e[i].v){
		int u=e[i].to;
		if(h[u]!=h[w]+1)continue;
		c=dfs(u,std::min(e[i].v,f-used));
		e[i].v-=c;
		e[i^1].v+=c;
		used+=c;
		if(f==used)return f;
	}
	h[w]=0;
	return used;
}
bool isp(int x){
	if(x<0)x=-x;
	if((~x&1)||x<3)return 0;
	for(int i=3;i*i<=x;i+=2)if(x%i==0)return 0;
	return 1;
}
void ae(int a,int b){
	e[ep]=(edge){b,e0[a],1};e0[a]=ep++;
	e[ep]=(edge){a,e0[b],0};e0[b]=ep++;
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;++i)scanf("%d",vs+i);
	for(int i=0,j=0;i<n;i=j){
		for(++j;j<n&&vs[j]-vs[j-1]==1;++j);
		xs[++xp]=vs[i];
		xs[++xp]=vs[j-1]+1;
	}
	S=xp+1,T=xp+2;
	int co=0,ce;
	for(int i=1;i<=xp;++i){
		if(xs[i]&1){
			ae(S,i);
			++co;
			for(int j=1;j<=xp;++j)if((~xs[j]&1)&&isp(xs[j]-xs[i]))ae(i,j);
		}else ae(i,T);
	}
	int ans=0,c2;
	while(bfs())ans+=dfs(S,0x3f3f);
	ce=xp-co;
	co-=ans,ce-=ans;
	printf("%d\n",ans+ce+co+(co&1));
	return 0;
}
```