#include<bits/stdc++.h>
using namespace std;
const int N=210,M=1e7+10;
int n,m,x[N],y[N],dp[N][N],prime[M],cnt;bool isp[M];
void init(){
	isp[0]=isp[1]=1;
	for (int i=2;i<M;i++){
		if (!isp[i]) prime[++cnt]=i;
		for (int j=1;j<=cnt&&i*prime[j]<M;j++){
			isp[i*prime[j]]=1;
			if (i%prime[j]==0) break;
		}
	}
	isp[2]=1;
}
//一般图最大带权匹配......
bool go[N][N];
int vis[N],match[N],C;
bool find(int x){
    for (int i=1;i<=m;i++)
    if (go[x][i]&&vis[i]!=C){
        vis[i]=C;
        if (!match[i]||find(match[i])){
            match[x]=i;
            match[i]=x;
            return 1;
        }
    }
    return 0;
}
int main()
{
	init();
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&x[i]);
	int last=y[++m]=x[1];
	for (int i=1;i<=n;i++)
    if (x[i]!=last) y[++m]=last,y[++m]=x[i],last=x[i]+1;else last++;
    y[++m]=last;
    for (int i=1;i<=m;i++)
    for (int j=1;j<=m;j++)
    if (!isp[abs(y[i]-y[j])]) go[i][j]=go[j][i]=1;
    int ans=0,odd=0,even=0;
    for (int i=1;i<=m;i++)
    if ((y[i]&1)&&!match[i]) C++,ans+=find(i);
    for (int i=1;i<=m;i++)
    if (!match[i]) y[i]&1?odd++:even++;
    ans+=odd/2*2;
    ans+=even/2*2;
    if (odd&1) ans+=3;
    printf("%d\n",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<bits/stdc++.h>
using namespace std;
const int N=210,M=1e7+10;
int n,m,x[N],y[N],dp[N][N],prime[M],cnt;bool isp[M];
void init(){
	isp[0]=isp[1]=1;
	for (int i=2;i<M;i++){
		if (!isp[i]) prime[++cnt]=i;
		for (int j=1;j<=cnt&&i*prime[j]<M;j++){
			isp[i*prime[j]]=1;
			if (i%prime[j]==0) break;
		}
	}
	isp[2]=1;
}
//一般图最大带权匹配......
bool go[N][N];
int vis[N],match[N],C;
bool find(int x){
    for (int i=1;i<=m;i++)
    if (go[x][i]&&vis[i]!=C){
        vis[i]=C;
        if (!match[i]||find(match[i])){
            match[x]=i;
            match[i]=x;
            return 1;
        }
    }
    return 0;
}
int main()
{
	init();
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&x[i]);
	int last=y[++m]=x[1];
	for (int i=1;i<=n;i++)
    if (x[i]!=last) y[++m]=last,y[++m]=x[i],last=x[i]+1;else last++;
    y[++m]=last;
    for (int i=1;i<=m;i++)
    for (int j=1;j<=m;j++)
    if (!isp[abs(y[i]-y[j])]) go[i][j]=go[j][i]=1;
    int ans=0,odd=0,even=0;
    for (int i=1;i<=m;i++)
    if ((y[i]&1)&&!match[i]) C++,ans+=find(i);
    for (int i=1;i<=m;i++)
    if (!match[i]) y[i]&1?odd++:even++;
    ans+=odd/2*2;
    ans+=even/2*2;
    if (odd&1) ans+=3;
    printf("%d\n",ans);
	return 0;
}

```