#include<bits/stdc++.h>
#define N 205
#define M 10000005
using namespace std;
bool B[M];
int n,a[N],m,k,P[M/10],w[N],G[N][N],mp[N],vis[N],cnt;
void prepare()
{
	int i,j; B[1]=1;
	for(i=2;i<M;i++){
		if(!B[i]) P[++m]=i;
		for(j=1;j<=m;j++){
			if(i*P[j]>=M) break;
			B[i*P[j]]=1;
			if(i%P[j]==0) break;
		  }
	  }
	B[2]=1;
}
int find(int t)
{
	int i,q=0;
	for(i=1;i<=m;i++){
		if(vis[i]==cnt||!G[t][i]) continue;
		vis[i]=cnt,q=mp[i],mp[i]=t;
		if(!q||find(q)) return 1;
		mp[i]=q;
	  }
	return 0;
}
int main()
{
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	prepare(),m=0;
	for(i=1;i<=n;i=j){
		for(j=i;j<=n&&a[j]==a[i]+j-i;j++);
		w[++m]=a[i],w[++m]=a[j-1]+1;
	  }
	for(i=1;i<=m;i++)
		if(w[i]%2==0)
			for(j=1;j<=m;j++)
				if(w[j]%2==1&&!B[abs(w[i]-w[j])])
					G[i][j]=1;
	for(i=1;i<=m;i++)
		if(w[i]%2==0)
			++cnt,k+=find(i);
	printf("%d",k+((cnt-k)/2+(m-cnt-k)/2)*2+((cnt-k)%2)*3);
	return 0;
}

### Prompt

Please formulate 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>
#define N 205
#define M 10000005
using namespace std;
bool B[M];
int n,a[N],m,k,P[M/10],w[N],G[N][N],mp[N],vis[N],cnt;
void prepare()
{
	int i,j; B[1]=1;
	for(i=2;i<M;i++){
		if(!B[i]) P[++m]=i;
		for(j=1;j<=m;j++){
			if(i*P[j]>=M) break;
			B[i*P[j]]=1;
			if(i%P[j]==0) break;
		  }
	  }
	B[2]=1;
}
int find(int t)
{
	int i,q=0;
	for(i=1;i<=m;i++){
		if(vis[i]==cnt||!G[t][i]) continue;
		vis[i]=cnt,q=mp[i],mp[i]=t;
		if(!q||find(q)) return 1;
		mp[i]=q;
	  }
	return 0;
}
int main()
{
	int i,j;
	scanf("%d",&n);
	for(i=1;i<=n;i++)
		scanf("%d",&a[i]);
	prepare(),m=0;
	for(i=1;i<=n;i=j){
		for(j=i;j<=n&&a[j]==a[i]+j-i;j++);
		w[++m]=a[i],w[++m]=a[j-1]+1;
	  }
	for(i=1;i<=m;i++)
		if(w[i]%2==0)
			for(j=1;j<=m;j++)
				if(w[j]%2==1&&!B[abs(w[i]-w[j])])
					G[i][j]=1;
	for(i=1;i<=m;i++)
		if(w[i]%2==0)
			++cnt,k+=find(i);
	printf("%d",k+((cnt-k)/2+(m-cnt-k)/2)*2+((cnt-k)%2)*3);
	return 0;
}

```