#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
int prime[10000010],pr=0;
bool vis[10000010];
int m,s[10000010],last=0,n=0;
int map[210][210],a[210],t1=0,b[210],t2=0,chw[210],match[210],tim=0;
bool findma(int x)
{
	for(int i=1;i<=t2;i++)
	{
		if(chw[i]==tim||!map[x][i]) continue;
		chw[i]=tim;
		if(!match[i]||findma(match[i])) return match[i]=x,true;
	}
	return false;
}
void pre()
{
	memset(vis,true,sizeof(vis));
	vis[1]=false;
	for(int i=2;i<=10000000;i++)
	{
		if(vis[i]) prime[++pr]=i;
		for(int j=1;j<=pr&&prime[j]*i<=10000000;j++)
		{
			vis[prime[j]*i]=false;
			if(i%prime[j]==0) break;
		}
	}
}
int main()
{
	pre();
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int c;scanf("%d",&c);
		s[c]=1;
	}
	for(int i=1;i<=1e7+1;i++)
		if(s[i]!=s[i-1])
		{
			//printf("%d\n",i);
			if(i&1) a[++t1]=i;
			else b[++t2]=i;
		}
	for (int i=1;i<=t1;i++)
        for (int j=1;j<=t2;j++)
            if (vis[abs(a[i]-b[j])]) map[i][j]=1;
    int ans=0,tmp=0;
    //printf("ok\n");
    for(int i=1;i<=t1;i++)
    {
    	tim++;
    	if(findma(i)) ans++,tmp++;
	}
	//printf("%d %d %d\n",tmp,t1,t2);
	ans+=(t1-tmp)/2*2+(t2-tmp)/2*2;
    if (t1%2!=tmp%2) ans+=3;
    printf("%d",ans);
}
### 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<cmath>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
using namespace std;
int prime[10000010],pr=0;
bool vis[10000010];
int m,s[10000010],last=0,n=0;
int map[210][210],a[210],t1=0,b[210],t2=0,chw[210],match[210],tim=0;
bool findma(int x)
{
	for(int i=1;i<=t2;i++)
	{
		if(chw[i]==tim||!map[x][i]) continue;
		chw[i]=tim;
		if(!match[i]||findma(match[i])) return match[i]=x,true;
	}
	return false;
}
void pre()
{
	memset(vis,true,sizeof(vis));
	vis[1]=false;
	for(int i=2;i<=10000000;i++)
	{
		if(vis[i]) prime[++pr]=i;
		for(int j=1;j<=pr&&prime[j]*i<=10000000;j++)
		{
			vis[prime[j]*i]=false;
			if(i%prime[j]==0) break;
		}
	}
}
int main()
{
	pre();
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int c;scanf("%d",&c);
		s[c]=1;
	}
	for(int i=1;i<=1e7+1;i++)
		if(s[i]!=s[i-1])
		{
			//printf("%d\n",i);
			if(i&1) a[++t1]=i;
			else b[++t2]=i;
		}
	for (int i=1;i<=t1;i++)
        for (int j=1;j<=t2;j++)
            if (vis[abs(a[i]-b[j])]) map[i][j]=1;
    int ans=0,tmp=0;
    //printf("ok\n");
    for(int i=1;i<=t1;i++)
    {
    	tim++;
    	if(findma(i)) ans++,tmp++;
	}
	//printf("%d %d %d\n",tmp,t1,t2);
	ans+=(t1-tmp)/2*2+(t2-tmp)/2*2;
    if (t1%2!=tmp%2) ans+=3;
    printf("%d",ans);
}
```