#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#define LL long long
#define fo(i,j,k) for(int i=j;i<=k;i++)
#define fd(i,j,k) for(int i=j;i>=k;i--)
#define fr(i,j) for(int i=beg[j];i;i=nex[i])
using namespace std;
int const mn=100+3,ma=1e7;
int n,a[mn],tag[ma],ss[ma],b[2][mn],
	gra,beg[mn],to[mn*mn],nex[mn*mn],vis[mn],re[mn];
void ins(int u,int v){
	to[++gra]=v;
	nex[gra]=beg[u];
	beg[u]=gra;
}
int dfs(int p){
	vis[p]=1;
	fr(i,p)if((!re[to[i]])||((!vis[re[to[i]]])&&dfs(re[to[i]]))){
		re[to[i]]=p;
		return 1;
	}
	return 0;
}
int main(){
	scanf("%d",&n);
	fo(i,1,n)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	b[a[1]&1][++b[a[1]&1][0]]=a[1];
	b[(a[n]+1)&1][++b[(a[n]+1)&1][0]]=a[n]+1;
	fo(i,2,n)if(a[i-1]+1!=a[i])
		b[(a[i-1]+1)&1][++b[(a[i-1]+1)&1][0]]=a[i-1]+1,
		b[a[i]&1][++b[a[i]&1][0]]=a[i];
	tag[1]=1;
	fo(i,2,ma){
		if(!tag[i])ss[++ss[0]]=i;
		fo(j,1,ss[0]){
			if(1ll*i*ss[j]>ma)break;
			tag[i*ss[j]]=1;
			if(!(i%ss[j]))break;
		}
	}
	fo(i,1,b[0][0])fo(j,1,b[1][0])
		if(!tag[abs(b[0][i]-b[1][j])])ins(i,j);
	int tmp=0;
	fo(i,1,b[0][0]){
		memset(vis,0,sizeof(vis));
		tmp+=dfs(i);
	}
	printf("%d",tmp+2*((b[0][0]-tmp)/2+(b[1][0]-tmp)/2)+3*((b[0][0]-tmp)&1));
	return 0;
}

### Prompt

In Cpp, your task is to solve 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<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#define LL long long
#define fo(i,j,k) for(int i=j;i<=k;i++)
#define fd(i,j,k) for(int i=j;i>=k;i--)
#define fr(i,j) for(int i=beg[j];i;i=nex[i])
using namespace std;
int const mn=100+3,ma=1e7;
int n,a[mn],tag[ma],ss[ma],b[2][mn],
	gra,beg[mn],to[mn*mn],nex[mn*mn],vis[mn],re[mn];
void ins(int u,int v){
	to[++gra]=v;
	nex[gra]=beg[u];
	beg[u]=gra;
}
int dfs(int p){
	vis[p]=1;
	fr(i,p)if((!re[to[i]])||((!vis[re[to[i]]])&&dfs(re[to[i]]))){
		re[to[i]]=p;
		return 1;
	}
	return 0;
}
int main(){
	scanf("%d",&n);
	fo(i,1,n)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	b[a[1]&1][++b[a[1]&1][0]]=a[1];
	b[(a[n]+1)&1][++b[(a[n]+1)&1][0]]=a[n]+1;
	fo(i,2,n)if(a[i-1]+1!=a[i])
		b[(a[i-1]+1)&1][++b[(a[i-1]+1)&1][0]]=a[i-1]+1,
		b[a[i]&1][++b[a[i]&1][0]]=a[i];
	tag[1]=1;
	fo(i,2,ma){
		if(!tag[i])ss[++ss[0]]=i;
		fo(j,1,ss[0]){
			if(1ll*i*ss[j]>ma)break;
			tag[i*ss[j]]=1;
			if(!(i%ss[j]))break;
		}
	}
	fo(i,1,b[0][0])fo(j,1,b[1][0])
		if(!tag[abs(b[0][i]-b[1][j])])ins(i,j);
	int tmp=0;
	fo(i,1,b[0][0]){
		memset(vis,0,sizeof(vis));
		tmp+=dfs(i);
	}
	printf("%d",tmp+2*((b[0][0]-tmp)/2+(b[1][0]-tmp)/2)+3*((b[0][0]-tmp)&1));
	return 0;
}

```