#include<iostream>
#include<cstdlib>
#include<vector>
#include<cstring>
using namespace std;
const int N=205,M=1e7+10;
int n,a[N],pri[M/10],tot,ans;
bool vis[M],b[M],ur[N];
int ld[N],rd[N],cl,cr,even,odd;
int lf[N];
vector<int>G[N];
void sieve(int n){
	vis[1]=1;
	for(int i=2;i<=n;++i){
		if(!vis[i])pri[++tot]=i;
		for(int j=1;j<=tot&&i*pri[j]<=n;++j){
			vis[i*pri[j]]=1;
			if(i%pri[j]==0)break;
		}
	}
}
bool dfs(int u){
	for(int to:G[u])
	if(!ur[to]){
		ur[to]=1;
		if(!lf[to]||dfs(lf[to])){
			lf[to]=u;
			return 1;
		}
	}
	return 0;
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		b[a[i]]=1;
	}
	for(int i=10000001;i;--i)if(b[i]^=b[i-1]){
		if(i&1)ld[++cl]=i;else rd[++cr]=i;
	}
	sieve(10000000);
	for(int i=1;i<=cl;++i)
	for(int j=1;j<=cr;++j)if(!vis[abs(ld[i]-rd[j])])G[i].push_back(j);
	memset(lf,0,sizeof lf);
	for(int i=1;i<=cl;++i){
		memset(ur,0,sizeof ur);
		ans+=dfs(i);
	}
	memset(ur,0,sizeof ur);
	for(int i=1;i<=cr;++i)ur[lf[i]]=1;
	for(int i=1;i<=cl;++i)if(!ur[i])++odd;
	for(int i=1;i<=cr;++i)if(!lf[i])++even;
	ans+=(odd>>1<<1)+(even>>1<<1)+(odd&1)*3;
	cout<<ans<<'\n';
	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<iostream>
#include<cstdlib>
#include<vector>
#include<cstring>
using namespace std;
const int N=205,M=1e7+10;
int n,a[N],pri[M/10],tot,ans;
bool vis[M],b[M],ur[N];
int ld[N],rd[N],cl,cr,even,odd;
int lf[N];
vector<int>G[N];
void sieve(int n){
	vis[1]=1;
	for(int i=2;i<=n;++i){
		if(!vis[i])pri[++tot]=i;
		for(int j=1;j<=tot&&i*pri[j]<=n;++j){
			vis[i*pri[j]]=1;
			if(i%pri[j]==0)break;
		}
	}
}
bool dfs(int u){
	for(int to:G[u])
	if(!ur[to]){
		ur[to]=1;
		if(!lf[to]||dfs(lf[to])){
			lf[to]=u;
			return 1;
		}
	}
	return 0;
}
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i){
		cin>>a[i];
		b[a[i]]=1;
	}
	for(int i=10000001;i;--i)if(b[i]^=b[i-1]){
		if(i&1)ld[++cl]=i;else rd[++cr]=i;
	}
	sieve(10000000);
	for(int i=1;i<=cl;++i)
	for(int j=1;j<=cr;++j)if(!vis[abs(ld[i]-rd[j])])G[i].push_back(j);
	memset(lf,0,sizeof lf);
	for(int i=1;i<=cl;++i){
		memset(ur,0,sizeof ur);
		ans+=dfs(i);
	}
	memset(ur,0,sizeof ur);
	for(int i=1;i<=cr;++i)ur[lf[i]]=1;
	for(int i=1;i<=cl;++i)if(!ur[i])++odd;
	for(int i=1;i<=cr;++i)if(!lf[i])++even;
	ans+=(odd>>1<<1)+(even>>1<<1)+(odd&1)*3;
	cout<<ans<<'\n';
	return 0;
}
```