#include<bits/stdc++.h>
#define Rint register int
using namespace std;
const int N = 203;
int n, m, x[N], y[N], ans, flyx[N], flyy[N];
bool vis[N], edge[N][N];
set<int> S;
inline bool isp(int x){
	if(x <= 2) return false;
	for(Rint i = 2;i * i <= x;i ++)
		if(!(x % i)) return false;
	return true;
}
inline bool dfs(int x){
	for(Rint y = 1;y <= m;y ++)
		if(edge[x][y] && !vis[y]){
			vis[y] = true;
			if(!flyy[y] || dfs(flyy[y])){
				flyx[x] = y; flyy[y] = x; return true;
			}
		}
	return false;
}
int main(){
	scanf("%d", &n);
	for(Rint i = 1;i <= n;i ++){
		int v; scanf("%d", &v);
		if(S.count(v)) S.erase(v);
		else S.insert(v);
		if(S.count(v + 1)) S.erase(v + 1);
		else S.insert(v + 1);
	}
	n = m = 0;
	for(int v : S)
		if(v & 1) x[++ n] = v;
		else y[++ m] = v;
	for(Rint i = 1;i <= n;i ++)
		for(Rint j = 1;j <= m;j ++)
			edge[i][j] = isp(abs(x[i] - y[j]));
	for(Rint i = 1;i <= n;i ++) if(!flyx[i]){
		memset(vis, 0, sizeof vis); ans += dfs(i);
	}
	printf("%d\n", n + m + (n - ans & 1) - ans);
}
### Prompt

Your challenge is to write a CPP solution to 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 Rint register int
using namespace std;
const int N = 203;
int n, m, x[N], y[N], ans, flyx[N], flyy[N];
bool vis[N], edge[N][N];
set<int> S;
inline bool isp(int x){
	if(x <= 2) return false;
	for(Rint i = 2;i * i <= x;i ++)
		if(!(x % i)) return false;
	return true;
}
inline bool dfs(int x){
	for(Rint y = 1;y <= m;y ++)
		if(edge[x][y] && !vis[y]){
			vis[y] = true;
			if(!flyy[y] || dfs(flyy[y])){
				flyx[x] = y; flyy[y] = x; return true;
			}
		}
	return false;
}
int main(){
	scanf("%d", &n);
	for(Rint i = 1;i <= n;i ++){
		int v; scanf("%d", &v);
		if(S.count(v)) S.erase(v);
		else S.insert(v);
		if(S.count(v + 1)) S.erase(v + 1);
		else S.insert(v + 1);
	}
	n = m = 0;
	for(int v : S)
		if(v & 1) x[++ n] = v;
		else y[++ m] = v;
	for(Rint i = 1;i <= n;i ++)
		for(Rint j = 1;j <= m;j ++)
			edge[i][j] = isp(abs(x[i] - y[j]));
	for(Rint i = 1;i <= n;i ++) if(!flyx[i]){
		memset(vis, 0, sizeof vis); ans += dfs(i);
	}
	printf("%d\n", n + m + (n - ans & 1) - ans);
}
```