#include <bits/stdc++.h>
using namespace std;
int n,x,pri[10000005],np[10000005],s[10000005],cnt1,cnt2,a[105],b[105],vis[205],mch[205],tot,ans;
vector<int>e[105];
bool dfs(int x)
{
	for(int i=0;i<e[x].size();i++) if(!vis[e[x][i]])
	{
		vis[e[x][i]]=1;
		if(!mch[e[x][i]]||dfs(mch[e[x][i]])){mch[e[x][i]]=x;return 1;}
	}
	return 0;
}
int main()
{
	for(int i=2;i<=1e7;i++)
	{
		if(!np[i]) pri[++tot]=i;
		for(int j=1;j<=tot&&i*pri[j]<=1e7;j++){np[i*pri[j]]=1;if(i%pri[j]==0) break;}
	}
	scanf("%d",&n);np[1]=1;
	for(int i=1;i<=n;i++) scanf("%d",&x),s[x]=1;
	for(int i=1;i<=10000001;i++) if(s[i]!=s[i-1]) (i&1)?a[++cnt1]=i:b[++cnt2]=i;
	for(int i=1;i<=cnt1;i++) for(int j=1;j<=cnt2;j++) if(!np[abs(a[i]-b[j])]) e[i].push_back(j);
	for(int i=1;i<=cnt1;i++) memset(vis,0,sizeof(vis)),ans+=dfs(i);
	printf("%d\n",ans+(cnt1-ans)/2*2+(cnt2-ans)/2*2+((cnt1-ans)&1)*3);
}
### 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 <bits/stdc++.h>
using namespace std;
int n,x,pri[10000005],np[10000005],s[10000005],cnt1,cnt2,a[105],b[105],vis[205],mch[205],tot,ans;
vector<int>e[105];
bool dfs(int x)
{
	for(int i=0;i<e[x].size();i++) if(!vis[e[x][i]])
	{
		vis[e[x][i]]=1;
		if(!mch[e[x][i]]||dfs(mch[e[x][i]])){mch[e[x][i]]=x;return 1;}
	}
	return 0;
}
int main()
{
	for(int i=2;i<=1e7;i++)
	{
		if(!np[i]) pri[++tot]=i;
		for(int j=1;j<=tot&&i*pri[j]<=1e7;j++){np[i*pri[j]]=1;if(i%pri[j]==0) break;}
	}
	scanf("%d",&n);np[1]=1;
	for(int i=1;i<=n;i++) scanf("%d",&x),s[x]=1;
	for(int i=1;i<=10000001;i++) if(s[i]!=s[i-1]) (i&1)?a[++cnt1]=i:b[++cnt2]=i;
	for(int i=1;i<=cnt1;i++) for(int j=1;j<=cnt2;j++) if(!np[abs(a[i]-b[j])]) e[i].push_back(j);
	for(int i=1;i<=cnt1;i++) memset(vis,0,sizeof(vis)),ans+=dfs(i);
	printf("%d\n",ans+(cnt1-ans)/2*2+(cnt2-ans)/2*2+((cnt1-ans)&1)*3);
}
```