#include<iostream>
#include<cstdio>
#include<vector>
#include<cstring>
using namespace std;
int n;
int res;
vector<int>v;
int lst=-1;
int match[210];
int me,mo;
int mx;
bool f[10000010];
vector<int>ok[210];
int vis[210];
int prm[1000010];
int sz;
int l;
bool bp(int x,int p)
{
	vis[x]=p;
	for(int i=0;i<ok[x].size();i++)
	{
		int y=ok[x][i];
		if(match[y]==-1 || (vis[match[y]]!=p && bp(match[y],p)))
		{
			match[y]=x;
			match[x]=y;
			return true;
		}
	}
	return false;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		if(x!=lst+1)
		{
			if(lst+1)v.push_back(lst+1);
			v.push_back(x);
		}
		lst=x;
		mx=lst+1;
	}
	v.push_back(lst+1);
	f[1]=true;
	for(int i=2;i<=mx;i++)
	{
		if(!f[i])prm[++sz]=i;
		for(int j=1;j<=sz;j++)
		{
			if(prm[j]*i>mx)break;
			f[prm[j]*i]=true;
			if(i%prm[j]==0)break;
		}
	}
	l=v.size();
	for(int i=0;i<l;i++)
	{
		match[i]=-1;
		if(v[i]&1)mo++;else me++;
		for(int j=i+1;j<l;j++)
		{
			if(v[j]-v[i]!=2 && !f[v[j]-v[i]])
			{
				ok[i].push_back(j);
				ok[j].push_back(i);
			}
		}
	}
	for(int i=0;i<l;i++)
	{
		if(match[i]>=0)continue;
		memset(vis,-1,sizeof(vis));
		if(bp(i,i))res++;
	}
	printf("%d",res+((me-res)/2+(mo-res)/2)*2+((me-res)%2)*3);
	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<iostream>
#include<cstdio>
#include<vector>
#include<cstring>
using namespace std;
int n;
int res;
vector<int>v;
int lst=-1;
int match[210];
int me,mo;
int mx;
bool f[10000010];
vector<int>ok[210];
int vis[210];
int prm[1000010];
int sz;
int l;
bool bp(int x,int p)
{
	vis[x]=p;
	for(int i=0;i<ok[x].size();i++)
	{
		int y=ok[x][i];
		if(match[y]==-1 || (vis[match[y]]!=p && bp(match[y],p)))
		{
			match[y]=x;
			match[x]=y;
			return true;
		}
	}
	return false;
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		if(x!=lst+1)
		{
			if(lst+1)v.push_back(lst+1);
			v.push_back(x);
		}
		lst=x;
		mx=lst+1;
	}
	v.push_back(lst+1);
	f[1]=true;
	for(int i=2;i<=mx;i++)
	{
		if(!f[i])prm[++sz]=i;
		for(int j=1;j<=sz;j++)
		{
			if(prm[j]*i>mx)break;
			f[prm[j]*i]=true;
			if(i%prm[j]==0)break;
		}
	}
	l=v.size();
	for(int i=0;i<l;i++)
	{
		match[i]=-1;
		if(v[i]&1)mo++;else me++;
		for(int j=i+1;j<l;j++)
		{
			if(v[j]-v[i]!=2 && !f[v[j]-v[i]])
			{
				ok[i].push_back(j);
				ok[j].push_back(i);
			}
		}
	}
	for(int i=0;i<l;i++)
	{
		if(match[i]>=0)continue;
		memset(vis,-1,sizeof(vis));
		if(bp(i,i))res++;
	}
	printf("%d",res+((me-res)/2+(mo-res)/2)*2+((me-res)%2)*3);
	return 0;
} 
```