#include<bits/stdc++.h>
using namespace std;
#define maxn 210
#define maxm 10000010
const int lim=1e7;
template <typename T>inline T read()
{
    register T sum=0;
    register char cc=getchar();
    int sym=1;
    while(cc!='-'&&(cc>'9'||cc<'0'))cc=getchar();
    if(cc=='-')sym=-1,cc=getchar();
    sum=sum*10+cc-'0';
    cc=getchar();
    while(cc>='0'&&cc<='9')sum=sum*10+cc-'0',cc=getchar();
    return sym*sum;
}
template <typename T>inline T read(T &a)
{
    a=read<T>();
    return a;
}
template <typename T,typename... Others> inline void read(T& a, Others&... b)
{
    a=read(a);
	read(b...);
}
struct Edge
{
	int v;
	Edge *next;
	Edge(int a=0,Edge *b=NULL)
	{
		v=a;
		next=b;
	}
}*head[maxn];
int n,mx,tim,cnt,cnt1,cnt2,ans,maxflow,a[maxm];
int L[maxn],R[maxn],p[maxm],vis[maxn],flg[maxm],match[maxn];
bool Match(int k)
{
	for(Edge *i=head[k];i!=NULL;i=i->next)
	{
		if(vis[i->v]==tim)
			continue;
		vis[i->v]=tim;
		if(!match[i->v]||Match(match[i->v]))
		{
			match[i->v]=k;
			return true;
		}
	}
	return false;
}
void init()
{
	flg[0]=flg[1]=true;
	for(int i=2;i<=lim;i++)
	{
		if(!flg[i])
			p[++cnt]=i;
		for(int j=1;j<=cnt&&p[j]*i<=lim;j++)
		{
			flg[i*p[j]]=true;
			if(i%p[j]==0)
				break;
		}
	}
}
int main()
{
	init();
	read(n);
	for(int i=1;i<=n;i++)
	{
		int x;
		read(x);
		a[x]+=1;
		mx=max(mx,x);
	}
	for(int i=1;i<=mx+1;i++)
	{
		if(a[i]!=a[i-1])
		{
			if(i&1)
				L[++cnt1]=i;
			else
				R[++cnt2]=i;
		}
	}
	for(int i=1;i<=cnt1;i++)
		for(int j=1;j<=cnt2;j++)
			if(!flg[abs(L[i]-R[j])])
				head[i]=new Edge(j,head[i]);
	for(int i=1;i<=cnt1;i++)
	{
		tim+=1;
		maxflow+=Match(i);
	}
	ans=maxflow;
	ans+=(cnt1-maxflow)/2*2+(cnt2-maxflow)/2*2;
	ans+=((cnt1-maxflow)&1)*3;
	printf("%d\n",ans);
    return 0;
}

### Prompt

Please provide a Cpp coded solution 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;
#define maxn 210
#define maxm 10000010
const int lim=1e7;
template <typename T>inline T read()
{
    register T sum=0;
    register char cc=getchar();
    int sym=1;
    while(cc!='-'&&(cc>'9'||cc<'0'))cc=getchar();
    if(cc=='-')sym=-1,cc=getchar();
    sum=sum*10+cc-'0';
    cc=getchar();
    while(cc>='0'&&cc<='9')sum=sum*10+cc-'0',cc=getchar();
    return sym*sum;
}
template <typename T>inline T read(T &a)
{
    a=read<T>();
    return a;
}
template <typename T,typename... Others> inline void read(T& a, Others&... b)
{
    a=read(a);
	read(b...);
}
struct Edge
{
	int v;
	Edge *next;
	Edge(int a=0,Edge *b=NULL)
	{
		v=a;
		next=b;
	}
}*head[maxn];
int n,mx,tim,cnt,cnt1,cnt2,ans,maxflow,a[maxm];
int L[maxn],R[maxn],p[maxm],vis[maxn],flg[maxm],match[maxn];
bool Match(int k)
{
	for(Edge *i=head[k];i!=NULL;i=i->next)
	{
		if(vis[i->v]==tim)
			continue;
		vis[i->v]=tim;
		if(!match[i->v]||Match(match[i->v]))
		{
			match[i->v]=k;
			return true;
		}
	}
	return false;
}
void init()
{
	flg[0]=flg[1]=true;
	for(int i=2;i<=lim;i++)
	{
		if(!flg[i])
			p[++cnt]=i;
		for(int j=1;j<=cnt&&p[j]*i<=lim;j++)
		{
			flg[i*p[j]]=true;
			if(i%p[j]==0)
				break;
		}
	}
}
int main()
{
	init();
	read(n);
	for(int i=1;i<=n;i++)
	{
		int x;
		read(x);
		a[x]+=1;
		mx=max(mx,x);
	}
	for(int i=1;i<=mx+1;i++)
	{
		if(a[i]!=a[i-1])
		{
			if(i&1)
				L[++cnt1]=i;
			else
				R[++cnt2]=i;
		}
	}
	for(int i=1;i<=cnt1;i++)
		for(int j=1;j<=cnt2;j++)
			if(!flg[abs(L[i]-R[j])])
				head[i]=new Edge(j,head[i]);
	for(int i=1;i<=cnt1;i++)
	{
		tim+=1;
		maxflow+=Match(i);
	}
	ans=maxflow;
	ans+=(cnt1-maxflow)/2*2+(cnt2-maxflow)/2*2;
	ans+=((cnt1-maxflow)&1)*3;
	printf("%d\n",ans);
    return 0;
}

```