#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
const int maxn=103;
const int maxt=10000007;

int n,a[maxn],pr[maxt],sz,N,o[maxn],e[maxn],szo,sze,match[maxn];
bool np[maxt],vis[maxn];

int dfs(int x){
	for(int i=1;i<=sze;++i){
		if(!vis[i]&&!np[abs(e[i]-o[x])]){
			vis[i]=true;
			if(!match[i]||dfs(match[i])){
				match[i]=x;
				return 1;
			}
		}
	}
	return 0;
}
vector<int> v;
bool flag[maxt];
int main(){
	scanf("%d",&n);
	a[0]=-1;
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		flag[a[i]]=true;
	}
	for(int i=1;i<maxt;++i){
		if((flag[i]^flag[i-1])==1)
			v.push_back(i);
	}
	np[1]=1;
	for(int i=2;i<maxt;++i){
		if(!np[i])
			pr[sz++]=i;
		for(int j=0;j<sz&&1ll*pr[j]*i<maxt;++j){
			np[pr[j]*i]=1;
			if(i%pr[j]==0)
				break;
		}
	}
	--sz;N=v.size();
//	for(int i=0;i<N;++i)
//		printf("%d ",v[i]);
//	puts("");
	for(int i=0;i<N;++i){
		if(v[i]%2==0) o[++szo]=v[i];
		else e[++sze]=v[i];
	}
	int  k=0;
	for(int i=1;i<=szo;++i){
		memset(vis,0,sizeof(vis));
		if(dfs(i)) ++k;
	}
	sze-=k;szo-=k;
//	printf("%d %d %d *\n",k,sze,szo);
	int res=k+((sze/2)+(szo/2))*2+(sze%2)*3;
	printf("%d\n",res);
	return 0;
}


### 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<bits/stdc++.h>

using namespace std;

typedef long long ll;
const int maxn=103;
const int maxt=10000007;

int n,a[maxn],pr[maxt],sz,N,o[maxn],e[maxn],szo,sze,match[maxn];
bool np[maxt],vis[maxn];

int dfs(int x){
	for(int i=1;i<=sze;++i){
		if(!vis[i]&&!np[abs(e[i]-o[x])]){
			vis[i]=true;
			if(!match[i]||dfs(match[i])){
				match[i]=x;
				return 1;
			}
		}
	}
	return 0;
}
vector<int> v;
bool flag[maxt];
int main(){
	scanf("%d",&n);
	a[0]=-1;
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		flag[a[i]]=true;
	}
	for(int i=1;i<maxt;++i){
		if((flag[i]^flag[i-1])==1)
			v.push_back(i);
	}
	np[1]=1;
	for(int i=2;i<maxt;++i){
		if(!np[i])
			pr[sz++]=i;
		for(int j=0;j<sz&&1ll*pr[j]*i<maxt;++j){
			np[pr[j]*i]=1;
			if(i%pr[j]==0)
				break;
		}
	}
	--sz;N=v.size();
//	for(int i=0;i<N;++i)
//		printf("%d ",v[i]);
//	puts("");
	for(int i=0;i<N;++i){
		if(v[i]%2==0) o[++szo]=v[i];
		else e[++sze]=v[i];
	}
	int  k=0;
	for(int i=1;i<=szo;++i){
		memset(vis,0,sizeof(vis));
		if(dfs(i)) ++k;
	}
	sze-=k;szo-=k;
//	printf("%d %d %d *\n",k,sze,szo);
	int res=k+((sze/2)+(szo/2))*2+(sze%2)*3;
	printf("%d\n",res);
	return 0;
}


```