#include<bits/stdc++.h> 
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
typedef long long ll;
using namespace std;
int check(int x){
	if (x==1) return 0;
	int i;
	fo(i,2,x-1){
		if (i*i>x) break;
		if (x%i==0) return 0;
	}return 1;
}
const int maxn=1e7+5;
int i,j,n;
int a[205],ans,b[205],n1,n2,f[205];
bool bz[maxn],w[205][205];
int bk[205],bp;
void add(int x){
	if (x&1) a[++n1]=x;else b[++n2]=x;
}
bool dfs(int x){
	if (bk[x]==bp) return 0;
	bk[x]=bp;
	int i;
	fo(i,1,n2) if(w[x][i]&&(!f[i]||dfs(f[i])))return f[i]=x,1;
	return 0;
}
int main(){
	scanf("%d",&n);
	fo(i,1,n){
		int x;
		scanf("%d",&x);
		bz[x]=1;
	}
	fd(i,maxn-1,1) {
		bz[i]^=bz[i-1];
		if (bz[i]) add(i);
	}
	fo(i,1,n1)
	fo(j,1,n2) w[i][j]=check(abs(a[i]-b[j]));
	fo(i,1,n1) bp++,ans+=dfs(i);
	n1-=ans,n2-=ans;
	if (n1&1) ans++;
	ans+=n1+n2;
	printf("%d\n",ans);
}

### 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> 
#define fo(i,a,b) for(i=a;i<=b;i++)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
typedef long long ll;
using namespace std;
int check(int x){
	if (x==1) return 0;
	int i;
	fo(i,2,x-1){
		if (i*i>x) break;
		if (x%i==0) return 0;
	}return 1;
}
const int maxn=1e7+5;
int i,j,n;
int a[205],ans,b[205],n1,n2,f[205];
bool bz[maxn],w[205][205];
int bk[205],bp;
void add(int x){
	if (x&1) a[++n1]=x;else b[++n2]=x;
}
bool dfs(int x){
	if (bk[x]==bp) return 0;
	bk[x]=bp;
	int i;
	fo(i,1,n2) if(w[x][i]&&(!f[i]||dfs(f[i])))return f[i]=x,1;
	return 0;
}
int main(){
	scanf("%d",&n);
	fo(i,1,n){
		int x;
		scanf("%d",&x);
		bz[x]=1;
	}
	fd(i,maxn-1,1) {
		bz[i]^=bz[i-1];
		if (bz[i]) add(i);
	}
	fo(i,1,n1)
	fo(j,1,n2) w[i][j]=check(abs(a[i]-b[j]));
	fo(i,1,n1) bp++,ans+=dfs(i);
	n1-=ans,n2-=ans;
	if (n1&1) ans++;
	ans+=n1+n2;
	printf("%d\n",ans);
}

```