#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<cmath>
using namespace std;

const int M = 1001;
int n,m,k,a[M],d[M],vis[M],ver[M],s0,s1,w0[M],w1[M],t;
vector<int> v[M];

bool check(int x)
{
	x=max(x,-x);
	if(x==1) return 0;
	int k=sqrt(x);
	for(int i=2;i<=k;i++) if(x%i==0) return 0;
	return 1;
}

void ins(int k)
{
	if(k%2) w1[++s1]=k;
	else w0[++s0]=k;
}

int dfs(int x)
{
	for(int i=0;i<v[x].size();i++)
	{
		if(vis[v[x][i]]==t) continue; vis[v[x][i]]=t;
		if(!ver[v[x][i]] || dfs(ver[v[x][i]])) 
		{
			ver[v[x][i]]=x; 
			return 1;
		}
	}
	return 0;
}

int main()
{
	scanf("%d",&n); a[0]=-1;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=a[i-1]+1) ins(a[i]);
		if(a[i+1]!=a[i]+1) ins(a[i]+1);
	}
	for(int i=1;i<=s1;i++)
		for(int j=1;j<=s0;j++)
			if(check(w1[i]-w0[j])) v[i].push_back(j);
	for(t=1;t<=s1;t++) k+=dfs(t);
	printf("%d",s1+s0-k+(s1-k)%2);
}
### Prompt

Construct a CPP code solution to the problem outlined:

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<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<vector>
#include<cmath>
using namespace std;

const int M = 1001;
int n,m,k,a[M],d[M],vis[M],ver[M],s0,s1,w0[M],w1[M],t;
vector<int> v[M];

bool check(int x)
{
	x=max(x,-x);
	if(x==1) return 0;
	int k=sqrt(x);
	for(int i=2;i<=k;i++) if(x%i==0) return 0;
	return 1;
}

void ins(int k)
{
	if(k%2) w1[++s1]=k;
	else w0[++s0]=k;
}

int dfs(int x)
{
	for(int i=0;i<v[x].size();i++)
	{
		if(vis[v[x][i]]==t) continue; vis[v[x][i]]=t;
		if(!ver[v[x][i]] || dfs(ver[v[x][i]])) 
		{
			ver[v[x][i]]=x; 
			return 1;
		}
	}
	return 0;
}

int main()
{
	scanf("%d",&n); a[0]=-1;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=a[i-1]+1) ins(a[i]);
		if(a[i+1]!=a[i]+1) ins(a[i]+1);
	}
	for(int i=1;i<=s1;i++)
		for(int j=1;j<=s0;j++)
			if(check(w1[i]-w0[j])) v[i].push_back(j);
	for(t=1;t<=s1;t++) k+=dfs(t);
	printf("%d",s1+s0-k+(s1-k)%2);
}
```