#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>

#define maxn 205
#define maxm 10000005

using namespace std;

inline int getint()
{
	int num=0,flag=1;char c;
	while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;
	while(c>='0'&&c<='9')num=num*10+c-48,c=getchar();
	return num*flag;
}

int n,N;
int a[maxn],w[maxn][maxn],link[maxn];
int pri[maxm],cnt;
bool np[maxm],col[maxm],vis[maxn];
int X[maxn],Y[maxn],ans;

inline void init()
{
	np[1]=1;
	for(int i=2;i<=N;i++)
	{
		if(!np[i])pri[++cnt]=i;
		for(int j=1;j<=cnt&&i*pri[j]<=N;j++)np[i*pri[j]]=1;
	}
}

inline bool match(int x)
{
	for(int i=1;i<=Y[0];i++)if(w[x][i]&&!vis[i])
	{
		vis[i]=1;
		if(!link[i]||match(link[i])){link[i]=x;return 1;}
	}
	return 0;
}

int main()
{
	n=getint();
	for(int i=1;i<=n;i++)N=max(N,a[i]=getint()),col[a[i]]=1;
	N++;init();
	for(int i=1;i<=N;i++)if(col[i]^col[i-1])i&1?X[++X[0]]=i:Y[++Y[0]]=i;
	for(int j=1;j<=Y[0];j++)for(int i=1;i<=X[0];i++)w[i][j]=!np[abs(X[i]-Y[j])];
	for(int i=1;i<=X[0];i++)
	{
		memset(vis,0,sizeof vis);
		ans+=match(i);
	}
	ans+=2*((X[0]-ans)/2)+2*((Y[0]-ans)/2)+3*((X[0]-ans)&1);
	printf("%d\n",ans);
}
### Prompt

Construct a CPP code solution to the problem outlined:

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<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>

#define maxn 205
#define maxm 10000005

using namespace std;

inline int getint()
{
	int num=0,flag=1;char c;
	while((c=getchar())<'0'||c>'9')if(c=='-')flag=-1;
	while(c>='0'&&c<='9')num=num*10+c-48,c=getchar();
	return num*flag;
}

int n,N;
int a[maxn],w[maxn][maxn],link[maxn];
int pri[maxm],cnt;
bool np[maxm],col[maxm],vis[maxn];
int X[maxn],Y[maxn],ans;

inline void init()
{
	np[1]=1;
	for(int i=2;i<=N;i++)
	{
		if(!np[i])pri[++cnt]=i;
		for(int j=1;j<=cnt&&i*pri[j]<=N;j++)np[i*pri[j]]=1;
	}
}

inline bool match(int x)
{
	for(int i=1;i<=Y[0];i++)if(w[x][i]&&!vis[i])
	{
		vis[i]=1;
		if(!link[i]||match(link[i])){link[i]=x;return 1;}
	}
	return 0;
}

int main()
{
	n=getint();
	for(int i=1;i<=n;i++)N=max(N,a[i]=getint()),col[a[i]]=1;
	N++;init();
	for(int i=1;i<=N;i++)if(col[i]^col[i-1])i&1?X[++X[0]]=i:Y[++Y[0]]=i;
	for(int j=1;j<=Y[0];j++)for(int i=1;i<=X[0];i++)w[i][j]=!np[abs(X[i]-Y[j])];
	for(int i=1;i<=X[0];i++)
	{
		memset(vis,0,sizeof vis);
		ans+=match(i);
	}
	ans+=2*((X[0]-ans)/2)+2*((Y[0]-ans)/2)+3*((X[0]-ans)&1);
	printf("%d\n",ans);
}
```