#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#define N 210
#define M 10000010
using namespace std;
int prime[M+10],link[N],tot;
bool p[M+10],vis[N];
int n,m;
bool can[N][N],s[M+10];
vector<int>v[2];
bool check(int u)
{
	for(int i=1;i<=m;i++)
	if(can[u][i] && !vis[i])
	{
		vis[i]=1;
		if(!link[i] || check(link[i]))
 		{
			link[i]=u;
			return true;
		}
	}
	return false;
}
int main()
{
	p[1]=true;
	for(int i=2;i<=M;i++)
	{
		if(!p[i]) prime[++tot]=i;
		for(int j=1;j<=tot && i*prime[j]<=M;j++)
		{
			p[i*prime[j]]=1;
			if(i%prime[j]==0) break;
		}
	}
	scanf("%d",&n);
	for(int i=1,u;i<=n;i++) scanf("%d",&u),s[u]=true;
	for(int i=1;i<=M;i++)
	if(s[i]^s[i-1]) v[i&1].push_back(i);
	n=v[0].size(),m=v[1].size();
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
		if(!p[abs(v[0][i]-v[1][j])]) can[i+1][j+1]=true;
	int ans=0;
    for(int i=1;i<=n;i++)
	{
		memset(vis,0,sizeof(vis));
		ans+=check(i);
	}
	int tmp=ans;
	ans+=(n-ans)/2*2+(m-ans)/2*2;
	printf("%d",ans+((n&1)!=(tmp&1)?3:0));
	return 0;
}
### Prompt

Create a solution in Cpp for 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<cstring>
#include<vector>
#include<cmath>
#define N 210
#define M 10000010
using namespace std;
int prime[M+10],link[N],tot;
bool p[M+10],vis[N];
int n,m;
bool can[N][N],s[M+10];
vector<int>v[2];
bool check(int u)
{
	for(int i=1;i<=m;i++)
	if(can[u][i] && !vis[i])
	{
		vis[i]=1;
		if(!link[i] || check(link[i]))
 		{
			link[i]=u;
			return true;
		}
	}
	return false;
}
int main()
{
	p[1]=true;
	for(int i=2;i<=M;i++)
	{
		if(!p[i]) prime[++tot]=i;
		for(int j=1;j<=tot && i*prime[j]<=M;j++)
		{
			p[i*prime[j]]=1;
			if(i%prime[j]==0) break;
		}
	}
	scanf("%d",&n);
	for(int i=1,u;i<=n;i++) scanf("%d",&u),s[u]=true;
	for(int i=1;i<=M;i++)
	if(s[i]^s[i-1]) v[i&1].push_back(i);
	n=v[0].size(),m=v[1].size();
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
		if(!p[abs(v[0][i]-v[1][j])]) can[i+1][j+1]=true;
	int ans=0;
    for(int i=1;i<=n;i++)
	{
		memset(vis,0,sizeof(vis));
		ans+=check(i);
	}
	int tmp=ans;
	ans+=(n-ans)/2*2+(m-ans)/2*2;
	printf("%d",ans+((n&1)!=(tmp&1)?3:0));
	return 0;
}
```