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

using namespace std;

const int N=105,M=1e7+5;

typedef long long LL;

int n,tot,p[M],f[N],vis[N],now,ans,s1,a[N],s2,b[N],cnt;

bool bz[M],Bit[M],g[N][N],u1[N],u2[N];

bool Check(int x)
{
	if (vis[x]==now) return 0;
	vis[x]=now;
	for (int i=1;i<=s2;i++) if (g[x][i])
	{
		if (!f[i] || Check(f[i]))
		{
			f[i]=x; return 1;
		}
	}
	return 0;
}

int main()
{
	bz[1]=1;
	for (int i=2;i<M;i++)
	{
		if (!bz[i]) p[tot++]=i;
		for (int j=0;j<tot && i*p[j]<M;j++)
		{
			bz[i*p[j]]=1;
			if (i%p[j]==0) break;
		}
	}
	scanf("%d",&n);
	for (int x,i=1;i<=n;i++)
	{
		scanf("%d",&x);
		Bit[x]^=1;
	}
	for (int i=1;i<M;i++) if (Bit[i]^Bit[i-1])
	{
		if (i&1) a[++s1]=i;else b[++s2]=i;
	}
	for (int i=1;i<=s1;i++) for (int j=1;j<=s2;j++) if (!bz[abs(a[i]-b[j])]) g[i][j]=1;
	for (now=1;now<=s1;now++) ans+=Check(now);
	for (int i=1;i<=s2;i++) if (f[i]) u1[f[i]]=u2[i]=1;
	for (int i=1;i<=s1;i++) if (!u1[i]) cnt++;
	ans+=(cnt/2)*2;
	cnt=0;
	for (int i=1;i<=s2;i++) if (!u2[i]) cnt++;
	ans+=(cnt/2)*2;
	if (cnt&1) ans+=3;
	printf("%d\n",ans);
	return 0;
}
### Prompt

In CPP, your task is to solve 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 <cstring>
#include <algorithm>
#include <cmath>

using namespace std;

const int N=105,M=1e7+5;

typedef long long LL;

int n,tot,p[M],f[N],vis[N],now,ans,s1,a[N],s2,b[N],cnt;

bool bz[M],Bit[M],g[N][N],u1[N],u2[N];

bool Check(int x)
{
	if (vis[x]==now) return 0;
	vis[x]=now;
	for (int i=1;i<=s2;i++) if (g[x][i])
	{
		if (!f[i] || Check(f[i]))
		{
			f[i]=x; return 1;
		}
	}
	return 0;
}

int main()
{
	bz[1]=1;
	for (int i=2;i<M;i++)
	{
		if (!bz[i]) p[tot++]=i;
		for (int j=0;j<tot && i*p[j]<M;j++)
		{
			bz[i*p[j]]=1;
			if (i%p[j]==0) break;
		}
	}
	scanf("%d",&n);
	for (int x,i=1;i<=n;i++)
	{
		scanf("%d",&x);
		Bit[x]^=1;
	}
	for (int i=1;i<M;i++) if (Bit[i]^Bit[i-1])
	{
		if (i&1) a[++s1]=i;else b[++s2]=i;
	}
	for (int i=1;i<=s1;i++) for (int j=1;j<=s2;j++) if (!bz[abs(a[i]-b[j])]) g[i][j]=1;
	for (now=1;now<=s1;now++) ans+=Check(now);
	for (int i=1;i<=s2;i++) if (f[i]) u1[f[i]]=u2[i]=1;
	for (int i=1;i<=s1;i++) if (!u1[i]) cnt++;
	ans+=(cnt/2)*2;
	cnt=0;
	for (int i=1;i<=s2;i++) if (!u2[i]) cnt++;
	ans+=(cnt/2)*2;
	if (cnt&1) ans+=3;
	printf("%d\n",ans);
	return 0;
}
```