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

int n,x,a[222],b[222],na,nb,c,ans,G[222][222],pre[222],used[222];
map<int,int>mp;

bool pri(int x){
	if (x==1) return 0;
	for (int i=3;i*i<=x;++i) if (x%i==0) return 0;
	return 1;
}

int dfs(int x){
	for (int i=1;i<=nb;++i) if (!used[i]&&G[x][i]){
		used[i]=1;
		if (!pre[i]||dfs(pre[i])){
			pre[i]=x;
			return 1;
		}
	}
	return 0;
}

int main(){
	for (cin>>n;n--;)
		cin>>x, mp[x]^=1, mp[x+1]^=1;
	for (auto o:mp) if (o.second)
		(o.first&1? a[++na]: b[++nb])=o.first;
	for (int i=1;i<=na;++i)
		for (int j=1;j<=nb;++j) if (pri(abs(a[i]-b[j])))
			G[i][j]=1;
	for (int i=1;i<=na;++i){
		memset(used,0,sizeof used);
		c+=dfs(i);
	}
	ans=c+((na-c)/2+(nb-c)/2)*2+(na-c)%2*3;
	cout<<ans;
}
### 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;

int n,x,a[222],b[222],na,nb,c,ans,G[222][222],pre[222],used[222];
map<int,int>mp;

bool pri(int x){
	if (x==1) return 0;
	for (int i=3;i*i<=x;++i) if (x%i==0) return 0;
	return 1;
}

int dfs(int x){
	for (int i=1;i<=nb;++i) if (!used[i]&&G[x][i]){
		used[i]=1;
		if (!pre[i]||dfs(pre[i])){
			pre[i]=x;
			return 1;
		}
	}
	return 0;
}

int main(){
	for (cin>>n;n--;)
		cin>>x, mp[x]^=1, mp[x+1]^=1;
	for (auto o:mp) if (o.second)
		(o.first&1? a[++na]: b[++nb])=o.first;
	for (int i=1;i<=na;++i)
		for (int j=1;j<=nb;++j) if (pri(abs(a[i]-b[j])))
			G[i][j]=1;
	for (int i=1;i<=na;++i){
		memset(used,0,sizeof used);
		c+=dfs(i);
	}
	ans=c+((na-c)/2+(nb-c)/2)*2+(na-c)%2*3;
	cout<<ans;
}
```