#include<bits/stdc++.h>
using namespace std;
int n;
class graph
{
	public:
		vector<int> v[1010];
		int match[1010];
		bool vis[1010];
		bool dfs(int np)
		{
			for(auto &x:v[np])
			{
				if(!vis[x])
				{
					vis[x]=1;
					if(!match[x]||dfs(match[x]))
					{
						match[x]=np;
						return 1;
					}
				}
			}
			return 0;
		}
}G;
vector<int> prime;
bool flag[10000010];
void init()
{
	flag[1]=1;
	for(int i=2;i<=10000000;i++)
	{
		if(!flag[i])prime.push_back(i);
		for(int j=0;j<prime.size()&&i*prime[j]<=10000000;j++)
		{
			flag[i*prime[j]]=1;
			if(i%prime[j]==0)break;
		}
	}
}
vector<int> v1,v2;
int col[10000010],m2[1010];
int main()
{
//	freopen("c.in","r",stdin);
	init();
	scanf("%d",&n);
	v1.push_back(0);v2.push_back(0);
	for(int i=1,ti;i<=n;i++)
	{
		scanf("%d",&ti);
		col[ti]=1;
	}
	for(int i=1;i<=10000001;i++)
	{
		if(col[i]!=col[i-1])
		{
			if(i&1)v1.push_back(i);
			else v2.push_back(i);
		}
	}
	for(int i=1;i<v1.size();i++)
	{
		for(int j=1;j<v2.size();j++)
		{
			if(!flag[abs(v2[j]-v1[i])])G.v[i].push_back(j);
		}
	}
	for(int i=1;i<v1.size();i++)
	{
		memset(G.vis,0,sizeof(G.vis));
		G.dfs(i);
	}
	int cnt1=0,cnt2=0,ans=0;
	for(int i=1;i<v2.size();i++)
	{
		if(G.match[i])m2[G.match[i]]=i,ans++;
		else cnt2++;
	}
	for(int i=1;i<v1.size();i++)
	{
		if(!m2[i])cnt1++;
	}
	ans+=(cnt1/2)*2;ans+=(cnt2/2)*2;
	cnt1%=2;cnt2%=2;
	if(cnt1&&cnt2)ans+=3;
	printf("%d\n",ans);
	return 0;
}
### Prompt

Generate 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>
using namespace std;
int n;
class graph
{
	public:
		vector<int> v[1010];
		int match[1010];
		bool vis[1010];
		bool dfs(int np)
		{
			for(auto &x:v[np])
			{
				if(!vis[x])
				{
					vis[x]=1;
					if(!match[x]||dfs(match[x]))
					{
						match[x]=np;
						return 1;
					}
				}
			}
			return 0;
		}
}G;
vector<int> prime;
bool flag[10000010];
void init()
{
	flag[1]=1;
	for(int i=2;i<=10000000;i++)
	{
		if(!flag[i])prime.push_back(i);
		for(int j=0;j<prime.size()&&i*prime[j]<=10000000;j++)
		{
			flag[i*prime[j]]=1;
			if(i%prime[j]==0)break;
		}
	}
}
vector<int> v1,v2;
int col[10000010],m2[1010];
int main()
{
//	freopen("c.in","r",stdin);
	init();
	scanf("%d",&n);
	v1.push_back(0);v2.push_back(0);
	for(int i=1,ti;i<=n;i++)
	{
		scanf("%d",&ti);
		col[ti]=1;
	}
	for(int i=1;i<=10000001;i++)
	{
		if(col[i]!=col[i-1])
		{
			if(i&1)v1.push_back(i);
			else v2.push_back(i);
		}
	}
	for(int i=1;i<v1.size();i++)
	{
		for(int j=1;j<v2.size();j++)
		{
			if(!flag[abs(v2[j]-v1[i])])G.v[i].push_back(j);
		}
	}
	for(int i=1;i<v1.size();i++)
	{
		memset(G.vis,0,sizeof(G.vis));
		G.dfs(i);
	}
	int cnt1=0,cnt2=0,ans=0;
	for(int i=1;i<v2.size();i++)
	{
		if(G.match[i])m2[G.match[i]]=i,ans++;
		else cnt2++;
	}
	for(int i=1;i<v1.size();i++)
	{
		if(!m2[i])cnt1++;
	}
	ans+=(cnt1/2)*2;ans+=(cnt2/2)*2;
	cnt1%=2;cnt2%=2;
	if(cnt1&&cnt2)ans+=3;
	printf("%d\n",ans);
	return 0;
}
```