// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=200+10,M=10000000+10;

int p[M],v[M],cnt=0;
void sieve(int n) {
	v[1]=1;
	for (int i=2;i<=n;++i) {
		if (!v[i]) p[++cnt]=i;
		for (int j=1;j<=cnt&&i*p[j]<=n;++j) {
			v[i*p[j]]=1;
			if (i%p[j]==0) break;
		}
	}
}

int n,a[M];
vector<int> L,R,E[N];

int vis[N],lnk[N];
bool dfs(int u) {
	for (int v:E[u]) {
		if (vis[v]) continue;
		vis[v]=1;
		if (!lnk[v]||dfs(lnk[v])) { lnk[v]=u; return 1; }
	}
	return 0;
}
int Hungary() {
	int res=0;
	for (int i=1;i<=L.size();++i) {
		memset(vis,0,sizeof(vis));
		if (dfs(i)) ++res;
	}
	return res;
}

int main() {
	sieve(10000000);
	n=read();
	for (int i=1;i<=n;++i) a[read()]=1;
	for (int i=1;i<M;++i) {
		if (a[i]==a[i-1]) continue;
		if (i&1) L.emplace_back(i);
		else R.emplace_back(i);
	}
	for (int i=0;i<L.size();++i)
		for (int j=0;j<R.size();++j) {
			if (v[abs(L[i]-R[j])]) continue;
			E[i+1].emplace_back(j+1);
		}
	int f=Hungary();
	printf("%d\n",f+(L.size()-f)/2*2+(R.size()-f)/2*2+((L.size()-f)&1)*3);
	return 0;
} 
### Prompt

Generate 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
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

const int N=200+10,M=10000000+10;

int p[M],v[M],cnt=0;
void sieve(int n) {
	v[1]=1;
	for (int i=2;i<=n;++i) {
		if (!v[i]) p[++cnt]=i;
		for (int j=1;j<=cnt&&i*p[j]<=n;++j) {
			v[i*p[j]]=1;
			if (i%p[j]==0) break;
		}
	}
}

int n,a[M];
vector<int> L,R,E[N];

int vis[N],lnk[N];
bool dfs(int u) {
	for (int v:E[u]) {
		if (vis[v]) continue;
		vis[v]=1;
		if (!lnk[v]||dfs(lnk[v])) { lnk[v]=u; return 1; }
	}
	return 0;
}
int Hungary() {
	int res=0;
	for (int i=1;i<=L.size();++i) {
		memset(vis,0,sizeof(vis));
		if (dfs(i)) ++res;
	}
	return res;
}

int main() {
	sieve(10000000);
	n=read();
	for (int i=1;i<=n;++i) a[read()]=1;
	for (int i=1;i<M;++i) {
		if (a[i]==a[i-1]) continue;
		if (i&1) L.emplace_back(i);
		else R.emplace_back(i);
	}
	for (int i=0;i<L.size();++i)
		for (int j=0;j<R.size();++j) {
			if (v[abs(L[i]-R[j])]) continue;
			E[i+1].emplace_back(j+1);
		}
	int f=Hungary();
	printf("%d\n",f+(L.size()-f)/2*2+(R.size()-f)/2*2+((L.size()-f)&1)*3);
	return 0;
} 
```