#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
int odd=0,even=0,Odd[105],Even[105],ma[105];
int flag[10000010],x[10000010],map[105][105],vis[105];
int prime[10000010],a[105];
int dfs(int u)
{
	for (int v=1;v<=even;v++)
	{
		if (!map[u][v]) continue;
		if (!vis[v])
		{
			vis[v]=1;
			if (ma[v]==-1||dfs(ma[v]))
			{
				ma[v]=u;
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	int n,cnt=0;
	scanf("%d",&n);
	flag[1]=1;
	for (int i=2;i<=10000001;i++)
	{
		if (!flag[i]) prime[++cnt]=i;
		for (int j=1;j<=cnt;j++)
		{
			if (i*prime[j]>10000001) break;
			flag[i*prime[j]]=1;
			if (i%prime[j]==0) break;
		}
	}
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		x[a[i]]^=1;
	}
	for (int i=1;i<=10000001;i++)
		if (x[i]!=x[i-1])
		{
			if (i&1) Odd[++odd]=i;
			else Even[++even]=i; 
		}
	for (int i=1;i<=odd;i++)
		for (int j=1;j<=even;j++)
			if (!flag[abs(Odd[i]-Even[j])]) map[i][j]=1;
	for (int i=1;i<=even;i++)
		ma[i]=-1;
	int sum=0;
	for (int i=1;i<=odd;i++)
	{
		memset(vis,0,sizeof(vis));
		if (dfs(i)) sum++;
	}
	int ans=sum+(((odd-sum)>>1)<<1)+(((even-sum)>>1)<<1)+(odd-sum)%2*3;
	printf("%d\n",ans);
	return 0;
}
### Prompt

Please formulate 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>
using namespace std;
typedef long long ll;
int odd=0,even=0,Odd[105],Even[105],ma[105];
int flag[10000010],x[10000010],map[105][105],vis[105];
int prime[10000010],a[105];
int dfs(int u)
{
	for (int v=1;v<=even;v++)
	{
		if (!map[u][v]) continue;
		if (!vis[v])
		{
			vis[v]=1;
			if (ma[v]==-1||dfs(ma[v]))
			{
				ma[v]=u;
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	int n,cnt=0;
	scanf("%d",&n);
	flag[1]=1;
	for (int i=2;i<=10000001;i++)
	{
		if (!flag[i]) prime[++cnt]=i;
		for (int j=1;j<=cnt;j++)
		{
			if (i*prime[j]>10000001) break;
			flag[i*prime[j]]=1;
			if (i%prime[j]==0) break;
		}
	}
	for (int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		x[a[i]]^=1;
	}
	for (int i=1;i<=10000001;i++)
		if (x[i]!=x[i-1])
		{
			if (i&1) Odd[++odd]=i;
			else Even[++even]=i; 
		}
	for (int i=1;i<=odd;i++)
		for (int j=1;j<=even;j++)
			if (!flag[abs(Odd[i]-Even[j])]) map[i][j]=1;
	for (int i=1;i<=even;i++)
		ma[i]=-1;
	int sum=0;
	for (int i=1;i<=odd;i++)
	{
		memset(vis,0,sizeof(vis));
		if (dfs(i)) sum++;
	}
	int ans=sum+(((odd-sum)>>1)<<1)+(((even-sum)>>1)<<1)+(odd-sum)%2*3;
	printf("%d\n",ans);
	return 0;
}
```