#include<bits/stdc++.h>
#define N 209
using namespace std;

int n,a[N],b[2],pre[N]; bool mp[N][N],bo[N],tg[10000009];
bool isprm(int x){
	if (x==1) return 0;
	int i;
	for (i=2; i*i<=x; i++) if (!(x%i)) return 0;
	return 1;
}
bool dfs(int x){
	int i;
	for (i=1; i<=n; i++) if (bo[i] && mp[x][i]){
		bo[i]=0;
		if (!pre[i] || dfs(pre[i])){
			pre[i]=x; return 1;
		}
	}
	return 0;
}
int main(){
	scanf("%d",&n);
	int i,j,k;
	for (i=1; i<=n; i++){
		scanf("%d",&k); tg[k]=1;
	}
	for (i=1,n=0; i<=10000001; i++)
		if (tg[i]^tg[i-1]) a[++n]=i;
	for (i=1; i<=n; i++) if (a[i]&1)
		for (j=1; j<=n; j++) if (a[j]&1^1)
			mp[i][j]=isprm(abs(a[i]-a[j]));
	int sum=0;
	for (i=1; i<=n; i++) if (a[i]&1){
		memset(bo,1,sizeof(bo));
		sum+=dfs(i);
	}
	for (i=1; i<=n; i++) b[a[i]&1]++;
	b[0]-=sum; b[1]-=sum;
	printf("%d\n",sum+b[0]+b[1]+(b[0]&b[1]&1));
	return 0;
}

### Prompt

Create a solution in cpp for 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 N 209
using namespace std;

int n,a[N],b[2],pre[N]; bool mp[N][N],bo[N],tg[10000009];
bool isprm(int x){
	if (x==1) return 0;
	int i;
	for (i=2; i*i<=x; i++) if (!(x%i)) return 0;
	return 1;
}
bool dfs(int x){
	int i;
	for (i=1; i<=n; i++) if (bo[i] && mp[x][i]){
		bo[i]=0;
		if (!pre[i] || dfs(pre[i])){
			pre[i]=x; return 1;
		}
	}
	return 0;
}
int main(){
	scanf("%d",&n);
	int i,j,k;
	for (i=1; i<=n; i++){
		scanf("%d",&k); tg[k]=1;
	}
	for (i=1,n=0; i<=10000001; i++)
		if (tg[i]^tg[i-1]) a[++n]=i;
	for (i=1; i<=n; i++) if (a[i]&1)
		for (j=1; j<=n; j++) if (a[j]&1^1)
			mp[i][j]=isprm(abs(a[i]-a[j]));
	int sum=0;
	for (i=1; i<=n; i++) if (a[i]&1){
		memset(bo,1,sizeof(bo));
		sum+=dfs(i);
	}
	for (i=1; i<=n; i++) b[a[i]&1]++;
	b[0]-=sum; b[1]-=sum;
	printf("%d\n",sum+b[0]+b[1]+(b[0]&b[1]&1));
	return 0;
}

```