#include <bits/stdc++.h>
#define M 10000005
using namespace std;
int d[700005],t,m,e[M],n,cnt,vis[205],w[205],g[205],u[40005],v[40005],nex[40005],a[205],b[205],A,B;
int find(int x){
	for (int i=g[x];i;i=nex[i])
	if (!vis[v[i]]){
		vis[v[i]]=1;
		if (!w[v[i]]||find(w[v[i]])){
			w[v[i]]=x; return 1;
		}
	}
	return 0;
}
int main(){
	for (int i=2;i<M;++i){
		if (!e[i]) d[++t]=i;
		for (int j=1;j<=t;++j){
			n=i*d[j]; if (n>=M) break;
			e[n]=1;	if (i%d[j]==0) break;
		}
	}
	scanf("%d",&n); t=0; e[0]=e[1]=e[2]=1;
	for (int i=1;i<=n;++i) scanf("%d",&a[i]);
	for (int i=1,j;i<=n;i=j+1){
		for (j=i;a[j+1]==a[j]+1;++j);
		b[++t]=a[i]; b[++t]=a[j]+1;
	}
	n=t;
	for (int i=1;i<=n;++i)
	if (b[i]&1)
	for (int j=1;j<=n;++j)
	if (!e[abs(b[j]-b[i])])
		u[++m]=i,v[m]=j,nex[m]=g[i],g[i]=m;
	for (int i=1;i<=n;++i)
	if (b[i]&1){
		for (int j=1;j<=n;++j) vis[j]=0;
		if (find(i)) ++cnt; ++A;
	}
	B=n-A-cnt; A-=cnt;
	cnt+=A/2*2+B/2*2;
	if (A&1) cnt+=3;
	printf("%d\n",cnt);
	return 0;
}
### Prompt

Please create a solution in CPP 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>
#define M 10000005
using namespace std;
int d[700005],t,m,e[M],n,cnt,vis[205],w[205],g[205],u[40005],v[40005],nex[40005],a[205],b[205],A,B;
int find(int x){
	for (int i=g[x];i;i=nex[i])
	if (!vis[v[i]]){
		vis[v[i]]=1;
		if (!w[v[i]]||find(w[v[i]])){
			w[v[i]]=x; return 1;
		}
	}
	return 0;
}
int main(){
	for (int i=2;i<M;++i){
		if (!e[i]) d[++t]=i;
		for (int j=1;j<=t;++j){
			n=i*d[j]; if (n>=M) break;
			e[n]=1;	if (i%d[j]==0) break;
		}
	}
	scanf("%d",&n); t=0; e[0]=e[1]=e[2]=1;
	for (int i=1;i<=n;++i) scanf("%d",&a[i]);
	for (int i=1,j;i<=n;i=j+1){
		for (j=i;a[j+1]==a[j]+1;++j);
		b[++t]=a[i]; b[++t]=a[j]+1;
	}
	n=t;
	for (int i=1;i<=n;++i)
	if (b[i]&1)
	for (int j=1;j<=n;++j)
	if (!e[abs(b[j]-b[i])])
		u[++m]=i,v[m]=j,nex[m]=g[i],g[i]=m;
	for (int i=1;i<=n;++i)
	if (b[i]&1){
		for (int j=1;j<=n;++j) vis[j]=0;
		if (find(i)) ++cnt; ++A;
	}
	B=n-A-cnt; A-=cnt;
	cnt+=A/2*2+B/2*2;
	if (A&1) cnt+=3;
	printf("%d\n",cnt);
	return 0;
}
```