#include<cstdio> 
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
using namespace std;
#define fo(i,j,k) for(i=j;i<=k;i++)
#define fd(i,j,k) for(i=j;i>=k;i--)
#define cmax(a,b) (a=(a>b)?a:b)
#define cmin(a,b) (a=(a<b)?a:b)
typedef long long ll;
const int N=1e6+5,M=1e7+50,mo=1e9+7;
int vis[N],pdd[N],pd[M],pri[N],Ref[N],d[N],e[N],c[M],x,ttt,n,i,j,ans,y;
int tt,b[N],nxt[N],fst[N];
void cr(int x,int y)
{
	tt++;
	b[tt]=y;
	nxt[tt]=fst[x];
	fst[x]=tt;
}
int dfs(int x)
{
	if (vis[x]==ttt) return 0;
	vis[x]=ttt;
	for (int p=fst[x];p;p=nxt[p])
	{
		if (!Ref[b[p]]||dfs(Ref[b[p]]))
		{
			Ref[b[p]]=x;
			pdd[x]=b[p];
			return 1;
		}
	}
	return 0;
}
void match()
{
	fo(i,1,n)
		if (!pdd[i])
		{
			ttt++;
			if (dfs(i)) ans++;
		}
}
void predo(int n)
{
	fo(i,2,n)
	{
		if (!pd[i]) pri[++pri[0]]=i;
		fo(j,1,pri[0])
		{
			if (1ll*i*pri[j]>n) break;
			pd[i*pri[j]]=1;
		}
	}
}
int main()
{
	scanf("%d",&n);
	fo(i,1,n)
	{
		scanf("%d",&x);
		c[x]^=1;
		c[x+1]^=1;
	}
	predo(1e7+5);
	fo(i,1,1e7+5)
		if (c[i])
		{
			if (i%2)
				d[++d[0]]=i;
			else e[++e[0]]=i;
		}
	pd[1]=pd[2]=1;
	fo(i,1,d[0])
		fo(j,1,e[0])
		if (!pd[abs(e[j]-d[i])])
			cr(i,j);
	ans=0;
	match();
	x=y=0;
	fo(i,1,d[0]) if (!pdd[i]) x++;
	fo(i,1,e[0]) if (!Ref[i]) y++;
	ans+=x-x%2+y-y%2;
	if (x%2) ans+=3;
	printf("%d",ans);
}
### 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<cstdio> 
#include<algorithm>
#include<cstring>
#include<cmath>
#include<set>
#include<map>
using namespace std;
#define fo(i,j,k) for(i=j;i<=k;i++)
#define fd(i,j,k) for(i=j;i>=k;i--)
#define cmax(a,b) (a=(a>b)?a:b)
#define cmin(a,b) (a=(a<b)?a:b)
typedef long long ll;
const int N=1e6+5,M=1e7+50,mo=1e9+7;
int vis[N],pdd[N],pd[M],pri[N],Ref[N],d[N],e[N],c[M],x,ttt,n,i,j,ans,y;
int tt,b[N],nxt[N],fst[N];
void cr(int x,int y)
{
	tt++;
	b[tt]=y;
	nxt[tt]=fst[x];
	fst[x]=tt;
}
int dfs(int x)
{
	if (vis[x]==ttt) return 0;
	vis[x]=ttt;
	for (int p=fst[x];p;p=nxt[p])
	{
		if (!Ref[b[p]]||dfs(Ref[b[p]]))
		{
			Ref[b[p]]=x;
			pdd[x]=b[p];
			return 1;
		}
	}
	return 0;
}
void match()
{
	fo(i,1,n)
		if (!pdd[i])
		{
			ttt++;
			if (dfs(i)) ans++;
		}
}
void predo(int n)
{
	fo(i,2,n)
	{
		if (!pd[i]) pri[++pri[0]]=i;
		fo(j,1,pri[0])
		{
			if (1ll*i*pri[j]>n) break;
			pd[i*pri[j]]=1;
		}
	}
}
int main()
{
	scanf("%d",&n);
	fo(i,1,n)
	{
		scanf("%d",&x);
		c[x]^=1;
		c[x+1]^=1;
	}
	predo(1e7+5);
	fo(i,1,1e7+5)
		if (c[i])
		{
			if (i%2)
				d[++d[0]]=i;
			else e[++e[0]]=i;
		}
	pd[1]=pd[2]=1;
	fo(i,1,d[0])
		fo(j,1,e[0])
		if (!pd[abs(e[j]-d[i])])
			cr(i,j);
	ans=0;
	match();
	x=y=0;
	fo(i,1,d[0]) if (!pdd[i]) x++;
	fo(i,1,e[0]) if (!Ref[i]) y++;
	ans+=x-x%2+y-y%2;
	if (x%2) ans+=3;
	printf("%d",ans);
}
```