#include<bits/stdc++.h>
using namespace std;
const int maxm=1e7+10,maxn=210;
int n,a[maxn],b[maxn],m,ans;
int b1[maxn],b2[maxn],p1,p2;
bool np[maxm],vis[maxn],g[maxn][maxn],s[maxm];
int match[maxn];
vector<int> p;

void init(){
	np[0]=np[1]=1;
	for(int i=2;i<maxm;++i){
		if(!np[i]){
			p.push_back(i);
			//cerr<<i<<endl;
			//system("pause");
		}
		for(int j=0,j_end=p.size(),x;j<j_end&&(x=p[j]*i)<maxm;++j){
			np[x]=true;
			if(i%p[j]==0)break;
		}
	}
	np[2]=1;
}

bool dfs(int u){
	for(int i=1;i<=p2;++i)if(g[u][i]&&!vis[i]){
		vis[i]=1;
		if(!match[i]||dfs(match[i])){
			match[i]=u;
			return true;
		}
	}
	return false;
}
void solve(){
	init();
	cin>>n;
	for(int i=1;i<=n;++i){cin>>a[i];s[a[i]]=1;}
	for(int i=1;i<maxm;++i){
		if(s[i]!=s[i-1])b[++m]=i;//,cerr<<b[m]<<endl;
	}
	//cerr<<m<<endl;
	for(int i=1;i<=m;++i){
		if(b[i]&1)b1[++p1]=b[i];
		else b2[++p2]=b[i];
	}
	//cerr<<p1<<" "<<p2<<endl;
	for(int i=1;i<=p1;++i){
		for(int j=1;j<=p2;++j){
			if(!np[abs(b1[i]-b2[j])]){
				//cerr<<i<<" "<<j<<endl;
				g[i][j]=true;
			}
		}
	}
	
	for(int i=1;i<=p1;++i){
		memset(vis,0,sizeof vis);
		if(dfs(i))++ans;//match()
	}
	p1-=ans;p2-=ans;
	//cerr<<ans<<endl;
	ans+=p1/2*2+p2/2*2;
	ans+=p1%2*3;
	//cerr<<ans<<endl;
	cout<<ans<<endl;
}
int main(){
	/*#ifndef ONLINE_JUDGE
	freopen("a.in","r",stdin);
	freopen("a.out","w",stdout);
	#endif*/
	solve();
	
	return 0;
}
### Prompt

Your task is to create 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;
const int maxm=1e7+10,maxn=210;
int n,a[maxn],b[maxn],m,ans;
int b1[maxn],b2[maxn],p1,p2;
bool np[maxm],vis[maxn],g[maxn][maxn],s[maxm];
int match[maxn];
vector<int> p;

void init(){
	np[0]=np[1]=1;
	for(int i=2;i<maxm;++i){
		if(!np[i]){
			p.push_back(i);
			//cerr<<i<<endl;
			//system("pause");
		}
		for(int j=0,j_end=p.size(),x;j<j_end&&(x=p[j]*i)<maxm;++j){
			np[x]=true;
			if(i%p[j]==0)break;
		}
	}
	np[2]=1;
}

bool dfs(int u){
	for(int i=1;i<=p2;++i)if(g[u][i]&&!vis[i]){
		vis[i]=1;
		if(!match[i]||dfs(match[i])){
			match[i]=u;
			return true;
		}
	}
	return false;
}
void solve(){
	init();
	cin>>n;
	for(int i=1;i<=n;++i){cin>>a[i];s[a[i]]=1;}
	for(int i=1;i<maxm;++i){
		if(s[i]!=s[i-1])b[++m]=i;//,cerr<<b[m]<<endl;
	}
	//cerr<<m<<endl;
	for(int i=1;i<=m;++i){
		if(b[i]&1)b1[++p1]=b[i];
		else b2[++p2]=b[i];
	}
	//cerr<<p1<<" "<<p2<<endl;
	for(int i=1;i<=p1;++i){
		for(int j=1;j<=p2;++j){
			if(!np[abs(b1[i]-b2[j])]){
				//cerr<<i<<" "<<j<<endl;
				g[i][j]=true;
			}
		}
	}
	
	for(int i=1;i<=p1;++i){
		memset(vis,0,sizeof vis);
		if(dfs(i))++ans;//match()
	}
	p1-=ans;p2-=ans;
	//cerr<<ans<<endl;
	ans+=p1/2*2+p2/2*2;
	ans+=p1%2*3;
	//cerr<<ans<<endl;
	cout<<ans<<endl;
}
int main(){
	/*#ifndef ONLINE_JUDGE
	freopen("a.in","r",stdin);
	freopen("a.out","w",stdout);
	#endif*/
	solve();
	
	return 0;
}
```