#include<bits/stdc++.h>
using namespace std;
const int N=205;
int x,n,a[N],c[2],match[N],b[N][N],flag[N],flag2[10000005];
int pd(int x){
	if (x==1)return 0;
	for (int i=2;i*i<=x;i++)
		if (x%i==0)return 0;
	return 1;
}
int dfs(int x){
	for (int i=1;i<=n;i++)
		if (flag[i]&&b[x][i]){
			flag[i]=0;
			if (!match[i]||dfs(match[i])){
				match[i]=x;
				return 1;
			}
		}
	return 0;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&x);
		flag2[x]=1;
	}
	n=0;
	for (int i=1;i<=10000001;i++)
		if (flag2[i]^flag2[i-1])a[++n]=i;
	for (int i=1;i<=n;i++)
		if (a[i]&1)for (int j=1;j<=n;j++)
			if (!(a[j]&1))b[i][j]=pd(abs(a[i]-a[j]));
	int sum=0;
	for (int i=1;i<=n;i++)
		if (a[i]&1){
			memset(flag,1,sizeof(flag));
			sum+=dfs(i);
		}
	for (int i=1;i<=n;i++)c[a[i]&1]++;
	c[0]-=sum;c[1]-=sum;
	printf("%d\n",sum+c[0]+c[1]+(c[0]&c[1]&1));
	return 0;
}

### 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<bits/stdc++.h>
using namespace std;
const int N=205;
int x,n,a[N],c[2],match[N],b[N][N],flag[N],flag2[10000005];
int pd(int x){
	if (x==1)return 0;
	for (int i=2;i*i<=x;i++)
		if (x%i==0)return 0;
	return 1;
}
int dfs(int x){
	for (int i=1;i<=n;i++)
		if (flag[i]&&b[x][i]){
			flag[i]=0;
			if (!match[i]||dfs(match[i])){
				match[i]=x;
				return 1;
			}
		}
	return 0;
}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&x);
		flag2[x]=1;
	}
	n=0;
	for (int i=1;i<=10000001;i++)
		if (flag2[i]^flag2[i-1])a[++n]=i;
	for (int i=1;i<=n;i++)
		if (a[i]&1)for (int j=1;j<=n;j++)
			if (!(a[j]&1))b[i][j]=pd(abs(a[i]-a[j]));
	int sum=0;
	for (int i=1;i<=n;i++)
		if (a[i]&1){
			memset(flag,1,sizeof(flag));
			sum+=dfs(i);
		}
	for (int i=1;i<=n;i++)c[a[i]&1]++;
	c[0]-=sum;c[1]-=sum;
	printf("%d\n",sum+c[0]+c[1]+(c[0]&c[1]&1));
	return 0;
}

```