#include<bits/stdc++.h>
using namespace std;
int n,b,ans=0;
int a[105],f[105][105];
int x[2][105],cnt[2],c;
int p[10000005],prime[3000005],tot=0;
int vis[105],link[105];

int dfs(int x){
	for(int i=1;i<=cnt[1];i++){
		if(vis[i]==0&&f[x][i]==1){
			vis[i]=1;
			if(link[i]==0||dfs(link[i])){
				link[i]=x;
				return 1;
			}
		}
	}
	return 0;
}

int main(){
	scanf("%d",&n);
	a[0]=-1;
	for(int i=2;i<=10000000;i++){
		if(p[i]==0) prime[++tot]=i;
		for(int j=1;j<=tot&&i*prime[j]<=10000000;j++){
			p[i*prime[j]]=1;
			if(i%prime[j]==0) break;
		}
	}
	p[1]=p[2]=1;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++){
		if(a[i]==a[i-1]+1) continue;
		if(a[i-1]!=-1) x[c=(a[i-1]+1)&1][++cnt[c]]=a[i-1]+1;
		x[c=a[i]&1][++cnt[c]]=a[i];
	}
	x[c=(a[n]+1)&1][++cnt[c]]=a[n]+1;
	for(int i=1;i<=cnt[0];i++){
		for(int j=1;j<=cnt[1];j++){
			if(p[abs(x[0][i]-x[1][j])]==0) f[i][j]=1;
		}
	}
	for(int i=1;i<=cnt[0];i++){
		memset(vis,0,sizeof(vis));
		if(dfs(i)) ans++;
	}
	cnt[1]-=ans,cnt[0]-=ans;
	ans+=2*(cnt[1]/2+cnt[0]/2);
	if(cnt[1]&1) ans+=3;
	printf("%d\n",ans);
	
	return 0;
}
### Prompt

Construct a CPP code solution to the problem outlined:

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,b,ans=0;
int a[105],f[105][105];
int x[2][105],cnt[2],c;
int p[10000005],prime[3000005],tot=0;
int vis[105],link[105];

int dfs(int x){
	for(int i=1;i<=cnt[1];i++){
		if(vis[i]==0&&f[x][i]==1){
			vis[i]=1;
			if(link[i]==0||dfs(link[i])){
				link[i]=x;
				return 1;
			}
		}
	}
	return 0;
}

int main(){
	scanf("%d",&n);
	a[0]=-1;
	for(int i=2;i<=10000000;i++){
		if(p[i]==0) prime[++tot]=i;
		for(int j=1;j<=tot&&i*prime[j]<=10000000;j++){
			p[i*prime[j]]=1;
			if(i%prime[j]==0) break;
		}
	}
	p[1]=p[2]=1;
	for(int i=1;i<=n;i++) scanf("%d",&a[i]);
	for(int i=1;i<=n;i++){
		if(a[i]==a[i-1]+1) continue;
		if(a[i-1]!=-1) x[c=(a[i-1]+1)&1][++cnt[c]]=a[i-1]+1;
		x[c=a[i]&1][++cnt[c]]=a[i];
	}
	x[c=(a[n]+1)&1][++cnt[c]]=a[n]+1;
	for(int i=1;i<=cnt[0];i++){
		for(int j=1;j<=cnt[1];j++){
			if(p[abs(x[0][i]-x[1][j])]==0) f[i][j]=1;
		}
	}
	for(int i=1;i<=cnt[0];i++){
		memset(vis,0,sizeof(vis));
		if(dfs(i)) ans++;
	}
	cnt[1]-=ans,cnt[0]-=ans;
	ans+=2*(cnt[1]/2+cnt[0]/2);
	if(cnt[1]&1) ans+=3;
	printf("%d\n",ans);
	
	return 0;
}
```