#include<bits/stdc++.h>
using namespace std;
#define left lft

const int N=1e7+5;
const int maxn=N+10;

int n,m,m0,m1,c[210],k1,left[210];
bool vis[210];
bool comp[maxn]; //composite
int primes,prime[maxn/10];

void prework()
{
	int i,j;
	comp[0]=comp[1]=1;
	for (i=2;i<=N;i++)
	{
		if (!comp[i]) prime[++primes]=i;
		for (j=1;j<=primes&&i*prime[j]<=N;j++)
		{
			comp[i*prime[j]]=1;
			if (i%prime[j]==0) break;
		}
	}
	comp[2]=1;
}

bool match(int u)
{
	for (int v=1;v<=m;v++)
	{
		if (comp[abs(c[u]-c[v])]||vis[v]) continue;
		vis[v]=1;
		if (!left[v]||match(left[v]))
		{
			left[v]=u;
			return 1;
		}
	}
	return 0;
}

int main()
{
#ifdef h10
	freopen("F.in","r",stdin);
	freopen("F.out","w",stdout);
#endif
	int i,x;
	prework();
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%d",&x);
		c[(i<<1)-1]=x;
		c[i<<1]=x+1;
	}
	sort(c+1,c+n+n+1);
	for (i=1;i<=n+n;i++)
		c[i]==c[m]?m--:c[++m]=c[i];

	for (i=1;i<=m;i++)
		c[i]&1?m1++:m0++;
	for (i=1;i<=m;i++)
	{
		memset(vis,0,sizeof(vis));
		if (c[i]&1) k1+=match(i);
	}
	m0-=k1; m1-=k1;
	printf("%d\n",k1+((m0>>1)+(m1>>1))*2+(m0&1)*3);
}

### 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<bits/stdc++.h>
using namespace std;
#define left lft

const int N=1e7+5;
const int maxn=N+10;

int n,m,m0,m1,c[210],k1,left[210];
bool vis[210];
bool comp[maxn]; //composite
int primes,prime[maxn/10];

void prework()
{
	int i,j;
	comp[0]=comp[1]=1;
	for (i=2;i<=N;i++)
	{
		if (!comp[i]) prime[++primes]=i;
		for (j=1;j<=primes&&i*prime[j]<=N;j++)
		{
			comp[i*prime[j]]=1;
			if (i%prime[j]==0) break;
		}
	}
	comp[2]=1;
}

bool match(int u)
{
	for (int v=1;v<=m;v++)
	{
		if (comp[abs(c[u]-c[v])]||vis[v]) continue;
		vis[v]=1;
		if (!left[v]||match(left[v]))
		{
			left[v]=u;
			return 1;
		}
	}
	return 0;
}

int main()
{
#ifdef h10
	freopen("F.in","r",stdin);
	freopen("F.out","w",stdout);
#endif
	int i,x;
	prework();
	scanf("%d",&n);
	for (i=1;i<=n;i++)
	{
		scanf("%d",&x);
		c[(i<<1)-1]=x;
		c[i<<1]=x+1;
	}
	sort(c+1,c+n+n+1);
	for (i=1;i<=n+n;i++)
		c[i]==c[m]?m--:c[++m]=c[i];

	for (i=1;i<=m;i++)
		c[i]&1?m1++:m0++;
	for (i=1;i<=m;i++)
	{
		memset(vis,0,sizeof(vis));
		if (c[i]&1) k1+=match(i);
	}
	m0-=k1; m1-=k1;
	printf("%d\n",k1+((m0>>1)+(m1>>1))*2+(m0&1)*3);
}

```