#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=1e7+5;
int n,x,ans,t[N+5],p[1000005],b[205][205],d1[205],d2[205],s[205];
bool bz[N+5],v[205];
bool dg(int x)
{
	for (int i=1;i<=d2[0];i++)
	if (b[x][i] && !v[i])
	{
		v[i]=1;
		if (!s[i] || dg(s[i]))
		{
			s[i]=x;
			return 1;
		}
	}
	return 0;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&x),bz[x]=1;
	for (int i=1;i<=N;i++) 
	if (bz[i]^bz[i-1]) 
	{
		if (i&1) d1[++d1[0]]=i; 
			else d2[++d2[0]]=i;
	}
	memset(bz,0,sizeof(bz));
	bz[1]=1;
	for (int i=2;i<=N;i++)
	{
		if (!bz[i]) p[++p[0]]=i;
		for (int j=1;j<=p[0] && i*p[j]<=N;j++)
		{
			bz[i*p[j]]=1;
			if (i%p[j]==0) break;
		}
	}
	bz[2]=1;
	for (int i=1;i<=d1[0];i++)
		for (int j=1;j<=d2[0];j++)
		if (!bz[abs(d1[i]-d2[j])]) b[i][j]=1;
	for (int i=1;i<=d1[0];i++)
	{
		memset(v,0,sizeof(v));
		if (dg(i)) ans++;
	}
	d1[0]-=ans,d2[0]-=ans;
	ans+=d1[0]/2*2+d2[0]/2*2+d1[0]%2*3;
	printf("%d",ans);
	return 0;
}

### Prompt

Your challenge is to write 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<cmath>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=1e7+5;
int n,x,ans,t[N+5],p[1000005],b[205][205],d1[205],d2[205],s[205];
bool bz[N+5],v[205];
bool dg(int x)
{
	for (int i=1;i<=d2[0];i++)
	if (b[x][i] && !v[i])
	{
		v[i]=1;
		if (!s[i] || dg(s[i]))
		{
			s[i]=x;
			return 1;
		}
	}
	return 0;
}
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&x),bz[x]=1;
	for (int i=1;i<=N;i++) 
	if (bz[i]^bz[i-1]) 
	{
		if (i&1) d1[++d1[0]]=i; 
			else d2[++d2[0]]=i;
	}
	memset(bz,0,sizeof(bz));
	bz[1]=1;
	for (int i=2;i<=N;i++)
	{
		if (!bz[i]) p[++p[0]]=i;
		for (int j=1;j<=p[0] && i*p[j]<=N;j++)
		{
			bz[i*p[j]]=1;
			if (i%p[j]==0) break;
		}
	}
	bz[2]=1;
	for (int i=1;i<=d1[0];i++)
		for (int j=1;j<=d2[0];j++)
		if (!bz[abs(d1[i]-d2[j])]) b[i][j]=1;
	for (int i=1;i<=d1[0];i++)
	{
		memset(v,0,sizeof(v));
		if (dg(i)) ans++;
	}
	d1[0]-=ans,d2[0]-=ans;
	ans+=d1[0]/2*2+d2[0]/2*2+d1[0]%2*3;
	printf("%d",ans);
	return 0;
}

```