#include<bits/stdc++.h>
using namespace std;
const int N=110;
bool pd(int k){
	if(k==1) return 0;
	int sk=sqrt(k);
	for(int i=2;i<=sk;i++) if(!(k%i)) return 0;
	return 1;
}
int n,b[N<<1],link[N],e[N<<1],o[N<<1];
bool g[N][N],vis[N];
bool dfs(int k){
	for(int i=1;i<=e[0];i++){
		if(g[k][i]&&!vis[i]){
			vis[i]=1;
			if(link[i]==-1||dfs(link[i])){
				link[i]=k;
				return 1;
			}
		}
	}
	return 0;
}
int main(){
	int tx;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&tx);
		if(b[b[0]]==tx) b[b[0]]++;
		else b[++b[0]]=tx,b[++b[0]]=tx+1;
	}
	for(int i=1;i<=b[0];i++){
		if(b[i]&1) o[++o[0]]=b[i];
		else e[++e[0]]=b[i];
	}
	for(int i=1;i<=o[0];i++)
		for(int j=1;j<=e[0];j++){
			if(pd(abs(o[i]-e[j]))) g[i][j]=1;
		}
	int k=0;
	memset(link,-1,sizeof(link));
	for(int i=1;i<=o[0];i++){
		memset(vis,0,sizeof(vis));
		if(dfs(i)) k++;
	}
//	cout<<k<<endl;
	cout<<k+((o[0]-k)/2+(e[0]-k)/2)*2+((e[0]-k)%2)*3<<endl;
}
### 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>
using namespace std;
const int N=110;
bool pd(int k){
	if(k==1) return 0;
	int sk=sqrt(k);
	for(int i=2;i<=sk;i++) if(!(k%i)) return 0;
	return 1;
}
int n,b[N<<1],link[N],e[N<<1],o[N<<1];
bool g[N][N],vis[N];
bool dfs(int k){
	for(int i=1;i<=e[0];i++){
		if(g[k][i]&&!vis[i]){
			vis[i]=1;
			if(link[i]==-1||dfs(link[i])){
				link[i]=k;
				return 1;
			}
		}
	}
	return 0;
}
int main(){
	int tx;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&tx);
		if(b[b[0]]==tx) b[b[0]]++;
		else b[++b[0]]=tx,b[++b[0]]=tx+1;
	}
	for(int i=1;i<=b[0];i++){
		if(b[i]&1) o[++o[0]]=b[i];
		else e[++e[0]]=b[i];
	}
	for(int i=1;i<=o[0];i++)
		for(int j=1;j<=e[0];j++){
			if(pd(abs(o[i]-e[j]))) g[i][j]=1;
		}
	int k=0;
	memset(link,-1,sizeof(link));
	for(int i=1;i<=o[0];i++){
		memset(vis,0,sizeof(vis));
		if(dfs(i)) k++;
	}
//	cout<<k<<endl;
	cout<<k+((o[0]-k)/2+(e[0]-k)/2)*2+((e[0]-k)%2)*3<<endl;
}
```