#include<bits/stdc++.h>

using namespace std;

#define N 800
#define M 10000005

int n,m,p,pr[M],pre[N],tot,a[N],ans,num;
bool ok[M],vis[N];
vector<int> g[N];
map<int,int> mp;

bool dfs(int u){
	for (int v:g[u])
		if (!vis[v]){
			vis[v]=1;
			if (!pre[v]||dfs(pre[v])){pre[v]=u; return 1;}
		}
	return 0;
}

int main(){
	p=10000001;
	for (int i=2;i<=p;++i){
		if (!ok[i]) pr[++tot]=i;
		for (int j=1;j<=tot;++j){
			if (i*pr[j]>p) break;
			ok[i*pr[j]]=1;
			if (i%pr[j]==0) break;
		}
	}
	ok[1]=ok[2]=1;
	scanf("%d",&n);
	for (int i=1;i<=n;++i){
		int x; scanf("%d",&x);
		mp[x]^=1; mp[x+1]^=1;
	}
	for (auto i:mp){
		if (i.second) a[++m]=i.first;
	}
	for (int i=1;i<=m;++i){
		for (int j=1;j<i;++j)
			if (!ok[a[i]-a[j]]){
				g[i].push_back(j);
				g[j].push_back(i);
			}
	}
	for (int i=1;i<=m;++i){
		memset(vis,0,sizeof vis);
		if (a[i]&1){
			if (dfs(i)) ++ans;
			++num;
		}
	}
	ans+=((num-ans)/2+(m-num-ans)/2)*2+((num-ans)&1)*3;
	printf("%d\n",ans);
	
	return 0;
}
			
### Prompt

Please provide a cpp coded solution 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>

using namespace std;

#define N 800
#define M 10000005

int n,m,p,pr[M],pre[N],tot,a[N],ans,num;
bool ok[M],vis[N];
vector<int> g[N];
map<int,int> mp;

bool dfs(int u){
	for (int v:g[u])
		if (!vis[v]){
			vis[v]=1;
			if (!pre[v]||dfs(pre[v])){pre[v]=u; return 1;}
		}
	return 0;
}

int main(){
	p=10000001;
	for (int i=2;i<=p;++i){
		if (!ok[i]) pr[++tot]=i;
		for (int j=1;j<=tot;++j){
			if (i*pr[j]>p) break;
			ok[i*pr[j]]=1;
			if (i%pr[j]==0) break;
		}
	}
	ok[1]=ok[2]=1;
	scanf("%d",&n);
	for (int i=1;i<=n;++i){
		int x; scanf("%d",&x);
		mp[x]^=1; mp[x+1]^=1;
	}
	for (auto i:mp){
		if (i.second) a[++m]=i.first;
	}
	for (int i=1;i<=m;++i){
		for (int j=1;j<i;++j)
			if (!ok[a[i]-a[j]]){
				g[i].push_back(j);
				g[j].push_back(i);
			}
	}
	for (int i=1;i<=m;++i){
		memset(vis,0,sizeof vis);
		if (a[i]&1){
			if (dfs(i)) ++ans;
			++num;
		}
	}
	ans+=((num-ans)/2+(m-num-ans)/2)*2+((num-ans)&1)*3;
	printf("%d\n",ans);
	
	return 0;
}
			
```