#include<bits/stdc++.h>
#define N 10000005
#define M 205
using namespace std;
int n,cnt1=0,cnt2=0,cnt,p1[M],p2[M],a[M],b[N],pr[M*M*100],match[N];bool vis[N],used[M],mp[M][M];
bool dfs(int u){
	for (int i=1;i<=cnt2;i++){
		if (!mp[u][i]||used[i]) continue;
		used[i]=1;
		if (!match[i]||dfs(match[i])){
			match[i]=u;
			return 1;
		}
	}
	return 0;
}
int main(){
	scanf("%d",&n);int mx=0;
	for (int i=1;i<=n;i++) scanf("%d",&a[i]),b[a[i]]=1,mx=max(mx,a[i]);
	for (int i=1;i<=mx+1;i++)
		if (b[i]!=b[i-1]){
			if (i&1) p1[++cnt1]=i;
			else p2[++cnt2]=i;
		}
	for (int i=2;i<=1e7;i++){
		if (!vis[i]) pr[++cnt]=i;
		for (int j=1;j<=cnt;j++){
			if (i*pr[j]>=N) break;
			vis[i*pr[j]]=1;
			if (i%pr[j]==0) break;
		}
	}
	vis[2]=vis[1]=1;int ans=0;
	for (int i=1;i<=cnt1;i++)
		for (int j=1;j<=cnt2;j++)
			if (!vis[abs(p1[i]-p2[j])]) mp[i][j]=1;
	for (int i=1;i<=cnt1;i++){
		memset(used,0,sizeof(used));
		if (dfs(i)) ans++;
	}
	int now1=cnt1-ans;int now2=cnt2-ans;
	ans=ans+(now1/2)*2+(now2/2)*2;
	if (now1&1) ans+=3;
	printf("%d\n",ans);
	return 0;
}
### Prompt

Develop a solution in Cpp to the problem described below:

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>
#define N 10000005
#define M 205
using namespace std;
int n,cnt1=0,cnt2=0,cnt,p1[M],p2[M],a[M],b[N],pr[M*M*100],match[N];bool vis[N],used[M],mp[M][M];
bool dfs(int u){
	for (int i=1;i<=cnt2;i++){
		if (!mp[u][i]||used[i]) continue;
		used[i]=1;
		if (!match[i]||dfs(match[i])){
			match[i]=u;
			return 1;
		}
	}
	return 0;
}
int main(){
	scanf("%d",&n);int mx=0;
	for (int i=1;i<=n;i++) scanf("%d",&a[i]),b[a[i]]=1,mx=max(mx,a[i]);
	for (int i=1;i<=mx+1;i++)
		if (b[i]!=b[i-1]){
			if (i&1) p1[++cnt1]=i;
			else p2[++cnt2]=i;
		}
	for (int i=2;i<=1e7;i++){
		if (!vis[i]) pr[++cnt]=i;
		for (int j=1;j<=cnt;j++){
			if (i*pr[j]>=N) break;
			vis[i*pr[j]]=1;
			if (i%pr[j]==0) break;
		}
	}
	vis[2]=vis[1]=1;int ans=0;
	for (int i=1;i<=cnt1;i++)
		for (int j=1;j<=cnt2;j++)
			if (!vis[abs(p1[i]-p2[j])]) mp[i][j]=1;
	for (int i=1;i<=cnt1;i++){
		memset(used,0,sizeof(used));
		if (dfs(i)) ans++;
	}
	int now1=cnt1-ans;int now2=cnt2-ans;
	ans=ans+(now1/2)*2+(now2/2)*2;
	if (now1&1) ans+=3;
	printf("%d\n",ans);
	return 0;
}
```