#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

const int N=105;
const int M=N*N;
const int L=10000000;

int last[N],bel[N];
int nxt[M],tov[M];
bool mark[L+5];
int pos[2][N];
bool vis[N];
int n,tot,mx,match,ans;

inline int iabs(int x){return x>0?x:-x;}

inline void insert(int x,int y){tov[++tot]=y,nxt[tot]=last[x],last[x]=tot;}

inline bool is_prime(int x)
{
	if (x==1) return 0;
	for (int i=2;i*i<=x;++i) if (!(x%i)) return 0;
	return 1;
}

bool hungary(int x)
{
	if (vis[x]) return 0;
	vis[x]=1;
	for (int i=last[x],y;i;i=nxt[i])
		if (!bel[y=tov[i]]||hungary(bel[y]))
			return bel[y]=x;
	return 0;
}

int main()
{
	//freopen("flip.in","r",stdin),freopen("flip.out","w",stdout);
	scanf("%d",&n);
	for (int i=1,x;i<=n;++i) scanf("%d",&x),mx=max(mx,x),mark[x]=1;
	for (int i=1;i<=mx+1;++i)
		if (mark[i]^mark[i-1])
			pos[i&1][++pos[i&1][0]]=i;
	for (int i=1;i<=pos[0][0];++i)
		for (int j=1;j<=pos[1][0];++j)
		{
			int d=iabs(pos[0][i]-pos[1][j]);
			if (is_prime(d)) insert(i,j);
		}
	match=0;
	for (int i=1;i<=pos[0][0];++i) memset(vis,0,sizeof vis),match+=hungary(i);
	ans=match,pos[0][0]-=match,pos[1][0]-=match;
	ans+=(pos[0][0]&1)+pos[0][0]+pos[1][0];
	printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	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
#include <iostream>
#include <cstring>
#include <cstdio>

using namespace std;

const int N=105;
const int M=N*N;
const int L=10000000;

int last[N],bel[N];
int nxt[M],tov[M];
bool mark[L+5];
int pos[2][N];
bool vis[N];
int n,tot,mx,match,ans;

inline int iabs(int x){return x>0?x:-x;}

inline void insert(int x,int y){tov[++tot]=y,nxt[tot]=last[x],last[x]=tot;}

inline bool is_prime(int x)
{
	if (x==1) return 0;
	for (int i=2;i*i<=x;++i) if (!(x%i)) return 0;
	return 1;
}

bool hungary(int x)
{
	if (vis[x]) return 0;
	vis[x]=1;
	for (int i=last[x],y;i;i=nxt[i])
		if (!bel[y=tov[i]]||hungary(bel[y]))
			return bel[y]=x;
	return 0;
}

int main()
{
	//freopen("flip.in","r",stdin),freopen("flip.out","w",stdout);
	scanf("%d",&n);
	for (int i=1,x;i<=n;++i) scanf("%d",&x),mx=max(mx,x),mark[x]=1;
	for (int i=1;i<=mx+1;++i)
		if (mark[i]^mark[i-1])
			pos[i&1][++pos[i&1][0]]=i;
	for (int i=1;i<=pos[0][0];++i)
		for (int j=1;j<=pos[1][0];++j)
		{
			int d=iabs(pos[0][i]-pos[1][j]);
			if (is_prime(d)) insert(i,j);
		}
	match=0;
	for (int i=1;i<=pos[0][0];++i) memset(vis,0,sizeof vis),match+=hungary(i);
	ans=match,pos[0][0]-=match,pos[1][0]-=match;
	ans+=(pos[0][0]&1)+pos[0][0]+pos[1][0];
	printf("%d\n",ans);
	//fclose(stdin),fclose(stdout);
	return 0;
}
```