#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define N 210
#define M 10000010
using namespace std;
int n,a[M],q[N],w[N],bz[M],p[M],last[N],nxt[N*N],to[N*N],tot=0,b[N],jy=0,ans=0;
void link(int x,int y)
{
	nxt[++tot]=last[x];last[x]=tot;to[tot]=y;
}
int dg(int x)
{
	if(bz[x]==tot) return 0;
	bz[x]=tot;
	for(int i=last[x];i;i=nxt[i])
	{
		int y=to[i];
		if(b[y]==0||dg(b[y]))
		{
			b[y]=x;return 1;
		}
	}
	return 0;
}
int main()
{
	fo(i,2,10000000)
	{
		if(!bz[i]) p[++p[0]]=i;
		fo(j,1,p[0])
		{
			int k=i*p[j];
			if(k>=10000000) break;
			bz[k]=1;
			if(i%p[j]==0) break;
		}
	}
	scanf("%d",&n);
	fo(i,1,n)
	{
		int x;scanf("%d",&x);
		a[x]=1;
	}
	fo(i,1,10000002)
	if(a[i]!=a[i-1])
	{
		if(i%2==1) q[++q[0]]=i;
		else w[++w[0]]=i;
	}
	bz[1]=bz[2]=1;
	fo(i,1,q[0]) fo(j,1,w[0]) if(bz[abs(q[i]-w[j])]==0) link(i,j);
	memset(bz,0,sizeof(bz));
	for(tot=1;tot<=n;tot++) jy+=dg(tot);
	ans=jy;
	ans+=2*((q[0]-jy)/2);
	ans+=2*((w[0]-jy)/2);
	ans+=3*((q[0]-jy)%2);
	printf("%d\n",ans);
}
### Prompt

Develop a solution in Cpp 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<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define N 210
#define M 10000010
using namespace std;
int n,a[M],q[N],w[N],bz[M],p[M],last[N],nxt[N*N],to[N*N],tot=0,b[N],jy=0,ans=0;
void link(int x,int y)
{
	nxt[++tot]=last[x];last[x]=tot;to[tot]=y;
}
int dg(int x)
{
	if(bz[x]==tot) return 0;
	bz[x]=tot;
	for(int i=last[x];i;i=nxt[i])
	{
		int y=to[i];
		if(b[y]==0||dg(b[y]))
		{
			b[y]=x;return 1;
		}
	}
	return 0;
}
int main()
{
	fo(i,2,10000000)
	{
		if(!bz[i]) p[++p[0]]=i;
		fo(j,1,p[0])
		{
			int k=i*p[j];
			if(k>=10000000) break;
			bz[k]=1;
			if(i%p[j]==0) break;
		}
	}
	scanf("%d",&n);
	fo(i,1,n)
	{
		int x;scanf("%d",&x);
		a[x]=1;
	}
	fo(i,1,10000002)
	if(a[i]!=a[i-1])
	{
		if(i%2==1) q[++q[0]]=i;
		else w[++w[0]]=i;
	}
	bz[1]=bz[2]=1;
	fo(i,1,q[0]) fo(j,1,w[0]) if(bz[abs(q[i]-w[j])]==0) link(i,j);
	memset(bz,0,sizeof(bz));
	for(tot=1;tot<=n;tot++) jy+=dg(tot);
	ans=jy;
	ans+=2*((q[0]-jy)/2);
	ans+=2*((w[0]-jy)/2);
	ans+=3*((q[0]-jy)%2);
	printf("%d\n",ans);
}
```