#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define N 2005
using namespace std;
int l[N],n,a[N],r[N],w[N],pr[5000005],f[N],a1[N][N];
bool bz[20000005],bp[N];
void prp()
{
	bz[1]=1;
	bz[0]=1;
	fo(i,2,20000000)
	{
		if(!bz[i]) pr[++pr[0]]=i;
		for(int j=1;j<=pr[0]&&i*pr[j]<=20000000;j++)
		{
			bz[i*pr[j]]=1;
			if(i%pr[j]==0) break;
		}
	}
	bz[2]=1;
}
bool find(int k)
{
	fo(i,1,a1[k][0])
	{
		int p=a1[k][i];
		if(!bp[p])
		{
			bp[p]=1;
			if(!f[p]||find(f[p])) 
			{
				f[p]=k;
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	cin>>n;
	prp();
	fo(i,1,n) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	fo(i,1,n) 
	{
		if(i==1||a[i-1]!=a[i]-1) w[++w[0]]=a[i];
		if(a[i+1]!=a[i]+1) w[++w[0]]=a[i]+1;
	}
	sort(w+1,w+w[0]+1);
	fo(i,1,w[0]) 
		if(w[i]%2==0) l[++l[0]]=w[i];
		else r[++r[0]]=w[i];
	fo(i,1,l[0])
	{
		fo(j,1,r[0])
		{
			if(!bz[abs(l[i]-r[j])]) a1[i][++a1[i][0]]=j;
		}
	}
	long long s=0;
	fo(i,1,l[0]) 
	{
		memset(bp,0,sizeof(bp));
		if(find(i)) s++;
	}
	printf("%lld",s+2*(long long)((l[0]-s)/2)+2*(long long)((r[0]-s)/2)+3*(long long)((l[0]-s)%2));
}
### Prompt

Please create a solution in Cpp 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 <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fod(i,a,b) for(int i=a;i>=b;i--)
#define N 2005
using namespace std;
int l[N],n,a[N],r[N],w[N],pr[5000005],f[N],a1[N][N];
bool bz[20000005],bp[N];
void prp()
{
	bz[1]=1;
	bz[0]=1;
	fo(i,2,20000000)
	{
		if(!bz[i]) pr[++pr[0]]=i;
		for(int j=1;j<=pr[0]&&i*pr[j]<=20000000;j++)
		{
			bz[i*pr[j]]=1;
			if(i%pr[j]==0) break;
		}
	}
	bz[2]=1;
}
bool find(int k)
{
	fo(i,1,a1[k][0])
	{
		int p=a1[k][i];
		if(!bp[p])
		{
			bp[p]=1;
			if(!f[p]||find(f[p])) 
			{
				f[p]=k;
				return 1;
			}
		}
	}
	return 0;
}
int main()
{
	cin>>n;
	prp();
	fo(i,1,n) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	fo(i,1,n) 
	{
		if(i==1||a[i-1]!=a[i]-1) w[++w[0]]=a[i];
		if(a[i+1]!=a[i]+1) w[++w[0]]=a[i]+1;
	}
	sort(w+1,w+w[0]+1);
	fo(i,1,w[0]) 
		if(w[i]%2==0) l[++l[0]]=w[i];
		else r[++r[0]]=w[i];
	fo(i,1,l[0])
	{
		fo(j,1,r[0])
		{
			if(!bz[abs(l[i]-r[j])]) a1[i][++a1[i][0]]=j;
		}
	}
	long long s=0;
	fo(i,1,l[0]) 
	{
		memset(bp,0,sizeof(bp));
		if(find(i)) s++;
	}
	printf("%lld",s+2*(long long)((l[0]-s)/2)+2*(long long)((r[0]-s)/2)+3*(long long)((l[0]-s)%2));
}
```