#include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<queue>
#include<cmath>
using namespace std;
void read(int &x){
	char ch;bool ok;
	for(ok=0,ch=getchar();!isdigit(ch);ch=getchar())if(ch=='-')ok=1;
	for(x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());if(ok)x=-x;
}
#define rg register
const int maxn=210;bool vis[maxn];
int f[maxn],n,ans,a[maxn],mp[maxn][maxn],b[maxn],tot1,tot2,x[maxn];
bool check(int x){
	if((!(x&1))||x==1)return 0;
	int n=sqrt(x);
	for(rg int i=2;i<=n;i++)
		if(!(x%i))return 0;
	return 1;
}
bool dfs(int x){
	for(rg int i=1;i<=tot2;i++)
		if(!vis[i]&&mp[x][i]){
			vis[i]=1;
			if(!f[i]||dfs(f[i]))return f[i]=x,1;
		}
	return 0;
}
int main(){
	read(n);
	for(rg int i=1;i<=n;i++)read(x[i]);
	if(n==1){printf("3\n");return 0;}
	for(rg int i=1;i<=n;i++){
		if(x[i+1]-x[i]!=1||i==n){
			if((x[i]+1)%2==0)a[++tot1]=x[i]+1;
			else b[++tot2]=x[i]+1;
		}
		if(x[i]-x[i-1]!=1||i==1){
			if(x[i]&1)b[++tot2]=x[i];
			else a[++tot1]=x[i];
		}
	}
	for(rg int i=1;i<=tot1;i++)
		for(rg int j=1;j<=tot2;j++)
			if(check(abs(a[i]-b[j])))mp[i][j]=1;
	for(rg int i=1;i<=tot1;i++){
		memset(vis,0,sizeof vis);
		if(dfs(i))ans++;
	}
	//	printf("%d\n",ans);
	printf("%d\n",ans+(tot1-ans)/2*2+(tot2-ans)/2*2+(tot1-ans)%2*3);
}

### 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<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<queue>
#include<cmath>
using namespace std;
void read(int &x){
	char ch;bool ok;
	for(ok=0,ch=getchar();!isdigit(ch);ch=getchar())if(ch=='-')ok=1;
	for(x=0;isdigit(ch);x=x*10+ch-'0',ch=getchar());if(ok)x=-x;
}
#define rg register
const int maxn=210;bool vis[maxn];
int f[maxn],n,ans,a[maxn],mp[maxn][maxn],b[maxn],tot1,tot2,x[maxn];
bool check(int x){
	if((!(x&1))||x==1)return 0;
	int n=sqrt(x);
	for(rg int i=2;i<=n;i++)
		if(!(x%i))return 0;
	return 1;
}
bool dfs(int x){
	for(rg int i=1;i<=tot2;i++)
		if(!vis[i]&&mp[x][i]){
			vis[i]=1;
			if(!f[i]||dfs(f[i]))return f[i]=x,1;
		}
	return 0;
}
int main(){
	read(n);
	for(rg int i=1;i<=n;i++)read(x[i]);
	if(n==1){printf("3\n");return 0;}
	for(rg int i=1;i<=n;i++){
		if(x[i+1]-x[i]!=1||i==n){
			if((x[i]+1)%2==0)a[++tot1]=x[i]+1;
			else b[++tot2]=x[i]+1;
		}
		if(x[i]-x[i-1]!=1||i==1){
			if(x[i]&1)b[++tot2]=x[i];
			else a[++tot1]=x[i];
		}
	}
	for(rg int i=1;i<=tot1;i++)
		for(rg int j=1;j<=tot2;j++)
			if(check(abs(a[i]-b[j])))mp[i][j]=1;
	for(rg int i=1;i<=tot1;i++){
		memset(vis,0,sizeof vis);
		if(dfs(i))ans++;
	}
	//	printf("%d\n",ans);
	printf("%d\n",ans+(tot1-ans)/2*2+(tot2-ans)/2*2+(tot1-ans)%2*3);
}

```