#include <bits/stdc++.h>
#define N 300
#define M 10000000
using namespace std;
 
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int n,A[N],B[N],a[M+10],pri[M];
int mps[N][N],lk[N],vis[N];
map<int,int> Ms;
inline int find(int x)
{
	for(int i=1;i<=B[0];i++) if(!vis[i]&&mps[x][i])
	{
		vis[i]=1; if(!lk[i]||find(lk[i]))
		{
			lk[i]=x; return 1;
		}
	}
	return 0;
}
int main()
{
	a[1]=1; for(int i=2;i<=M;i++)
	{
		if(!a[i]) pri[++pri[0]]=i;
		for(int j=1;j<=pri[0]&&pri[j]*i<=M;j++)
		{
			a[pri[j]*i]=1; if(i%pri[j]==0) break;
		}
	}
	n=read();
	for(int i=1;i<=n;i++)
	{
		int x=read(); Ms[x]^=1; Ms[x+1]^=1;
	}
	map<int,int> ::iterator it=Ms.begin();
	for(;it!=Ms.end();it++) if(it->second)
	{
		if(it->first&1) A[++A[0]]=it->first;
		else B[++B[0]]=it->first;
	}
	for(int i=1;i<=A[0];i++) for(int j=1;j<=B[0];j++)
		if(!a[abs(A[i]-B[j])]) mps[i][j]=1;
	int ct=0; for(int i=1;i<=A[0];i++)
		memset(vis,0,sizeof vis),ct+=find(i);
	cout << ct+((A[0]-ct)/2+(B[0]-ct)/2)*2+(A[0]-ct)%2*3 << endl;
	return 0;
}
### Prompt

Your task is to create 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>
#define N 300
#define M 10000000
using namespace std;
 
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
int n,A[N],B[N],a[M+10],pri[M];
int mps[N][N],lk[N],vis[N];
map<int,int> Ms;
inline int find(int x)
{
	for(int i=1;i<=B[0];i++) if(!vis[i]&&mps[x][i])
	{
		vis[i]=1; if(!lk[i]||find(lk[i]))
		{
			lk[i]=x; return 1;
		}
	}
	return 0;
}
int main()
{
	a[1]=1; for(int i=2;i<=M;i++)
	{
		if(!a[i]) pri[++pri[0]]=i;
		for(int j=1;j<=pri[0]&&pri[j]*i<=M;j++)
		{
			a[pri[j]*i]=1; if(i%pri[j]==0) break;
		}
	}
	n=read();
	for(int i=1;i<=n;i++)
	{
		int x=read(); Ms[x]^=1; Ms[x+1]^=1;
	}
	map<int,int> ::iterator it=Ms.begin();
	for(;it!=Ms.end();it++) if(it->second)
	{
		if(it->first&1) A[++A[0]]=it->first;
		else B[++B[0]]=it->first;
	}
	for(int i=1;i<=A[0];i++) for(int j=1;j<=B[0];j++)
		if(!a[abs(A[i]-B[j])]) mps[i][j]=1;
	int ct=0; for(int i=1;i<=A[0];i++)
		memset(vis,0,sizeof vis),ct+=find(i);
	cout << ct+((A[0]-ct)/2+(B[0]-ct)/2)*2+(A[0]-ct)%2*3 << endl;
	return 0;
}
```