#include<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,b,a) for(int i=b;i>=a;i--)
#define efo(i,u,v) for(int i=BB[u],v=B[BB[u]][1];i;v=B[i=B[i][0]][1])
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
char ch;
int read(){int n=0,p=1;for(ch=getchar();ch<'0' || '9'<ch;ch=getchar())if(ch=='-') p=-1;for(;'0'<=ch && ch<='9';ch=getchar()) n=n*10+ch-'0';return n*p;}
const int N=205,M=2e7+5;
int n,m,a[N],d[N<<1],pr[M];
bool b[M],c[M],bz[M];
void prep()
{
	mset(bz,1);
	bz[0]=bz[1]=0;
	fo(i,2,m)
	{
		if(bz[i]) pr[++pr[0]]=i;
		fo(j,1,pr[0])
		{
			ll x=(ll)i*pr[j];
			if(x>m) break;
			bz[x]=0;
			if(i%pr[j]==0) break;
		}
	}
}
const int V=N<<3,INF=1e9;
const int E=10*V*V;
int B0,BB[V],pos[V],B[E][2];
bool vis[V];
void link(int u,int v){B[++B0][1]=v,B[B0][0]=BB[u],BB[u]=B0;}
bool match(int x)
{
	if(vis[x]==1) return 0;
	vis[x]=1;
	efo(i,x,y)
		if(!pos[y] || match(pos[y]))
		{
			pos[y]=x;
			return 1;
		}
	return 0;
}
int main()
{
	n=read();
	fo(i,1,n) a[i]=read(),b[a[i]]=1,m=max(m,a[i]);
	++m;
	prep();
	fo(i,1,m) c[i]=b[i]^b[i-1];
	fo(i,1,m) if(c[i]) d[++d[0]]=i;
	fo(i,1,d[0])if(d[i]&1)
		fo(j,1,d[0])if(!(d[j]&1))
			if(bz[abs(d[i]-d[j])]) link(i,d[0]+j);
	int cnt=0,odd=0,even=0;
	fo(i,1,d[0]+d[0])
	{
		mset(vis,0);
		if(match(i)) ++cnt;
	}
	fo(i,1,d[0])if(d[i]&1) ++odd;else ++even;
	int ans=cnt+((odd-cnt)/2)*2+((even-cnt)/2)*2;
	if((odd-cnt)%2==1) ans+=3;
	printf("%d",ans);
	return 0;
}
### 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<cstdio>
#include<cstring>
#include<algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,b,a) for(int i=b;i>=a;i--)
#define efo(i,u,v) for(int i=BB[u],v=B[BB[u]][1];i;v=B[i=B[i][0]][1])
#define mset(a,x) memset(a,x,sizeof(a))
using namespace std;
typedef long long ll;
char ch;
int read(){int n=0,p=1;for(ch=getchar();ch<'0' || '9'<ch;ch=getchar())if(ch=='-') p=-1;for(;'0'<=ch && ch<='9';ch=getchar()) n=n*10+ch-'0';return n*p;}
const int N=205,M=2e7+5;
int n,m,a[N],d[N<<1],pr[M];
bool b[M],c[M],bz[M];
void prep()
{
	mset(bz,1);
	bz[0]=bz[1]=0;
	fo(i,2,m)
	{
		if(bz[i]) pr[++pr[0]]=i;
		fo(j,1,pr[0])
		{
			ll x=(ll)i*pr[j];
			if(x>m) break;
			bz[x]=0;
			if(i%pr[j]==0) break;
		}
	}
}
const int V=N<<3,INF=1e9;
const int E=10*V*V;
int B0,BB[V],pos[V],B[E][2];
bool vis[V];
void link(int u,int v){B[++B0][1]=v,B[B0][0]=BB[u],BB[u]=B0;}
bool match(int x)
{
	if(vis[x]==1) return 0;
	vis[x]=1;
	efo(i,x,y)
		if(!pos[y] || match(pos[y]))
		{
			pos[y]=x;
			return 1;
		}
	return 0;
}
int main()
{
	n=read();
	fo(i,1,n) a[i]=read(),b[a[i]]=1,m=max(m,a[i]);
	++m;
	prep();
	fo(i,1,m) c[i]=b[i]^b[i-1];
	fo(i,1,m) if(c[i]) d[++d[0]]=i;
	fo(i,1,d[0])if(d[i]&1)
		fo(j,1,d[0])if(!(d[j]&1))
			if(bz[abs(d[i]-d[j])]) link(i,d[0]+j);
	int cnt=0,odd=0,even=0;
	fo(i,1,d[0]+d[0])
	{
		mset(vis,0);
		if(match(i)) ++cnt;
	}
	fo(i,1,d[0])if(d[i]&1) ++odd;else ++even;
	int ans=cnt+((odd-cnt)/2)*2+((even-cnt)/2)*2;
	if((odd-cnt)%2==1) ans+=3;
	printf("%d",ans);
	return 0;
}
```