#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
using namespace std;
#define clr(a) memset(a,0,sizeof(a))
//--Container
#include<set>
//
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pi;
  
struct eg{int u,v,nx;}gp[50010];int cnt,hd[210],mth[210];bool bd[210];
void psh(int u,int v){++cnt;gp[cnt].u=u,gp[cnt].v=v,gp[cnt].nx=hd[u],hd[u]=cnt;};
  
bool fdp(int v){
    int i;for(i=hd[v];i;i=gp[i].nx)if(!bd[gp[i].v]){
        bd[gp[i].v]=1;
        if(!mth[gp[i].v]||fdp(mth[gp[i].v])){
            mth[gp[i].v]=v;
            return 1;
        }
    }
    return 0;
};
int hgy(int n){
    int rs=0,i;for(clr(mth),i=1;i<=n;++i){
        clr(bd);if(fdp(i))++rs;
    }
    return rs;
};
  
int ar[110],dr[210],cr[2][210],dn,n;
  
bool _ck(int n){
    if(n==1)return 0;int d=sqrt(n),i=2;for(;i<=d;++i)if(!(n%i))return 0;
    return 1;
};
  
bool cl(){
    if(scanf("%d",&n)==-1)return 0;
    int i,j,t,a,b,k;for(i=1;i<=n;scanf("%d",&ar[i++]));sort(ar+1,ar+n+1);n=unique(ar+1,ar+n+1)-ar-1;
    for(dn=1,dr[1]=ar[1],i=2;i<=n;++i){
        if(ar[i]==ar[i-1]+1)continue;
        dr[++dn]=ar[i-1]+1,dr[++dn]=ar[i];
    }
    dr[++dn]=ar[n]+1;
    for(a=b=0,i=1;i<=dn;++i){
        if(dr[i]&1)cr[1][++a]=dr[i];
        else
            cr[0][++b]=dr[i];
    }
    for(cnt=0,clr(hd),i=1;i<=a;++i)for(j=1;j<=b;++j)if(_ck(abs(cr[1][i]-cr[0][j])))
        psh(i,j);
    t=hgy(a);
    printf("%d\n",t+((a-t)/2*2)+((b-t)/2*2)+((a-t)%2*3));
    return 1;
};
  
int main() {
    while(cl());
    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<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<string>
#include<cmath>
using namespace std;
#define clr(a) memset(a,0,sizeof(a))
//--Container
#include<set>
//
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pi;
  
struct eg{int u,v,nx;}gp[50010];int cnt,hd[210],mth[210];bool bd[210];
void psh(int u,int v){++cnt;gp[cnt].u=u,gp[cnt].v=v,gp[cnt].nx=hd[u],hd[u]=cnt;};
  
bool fdp(int v){
    int i;for(i=hd[v];i;i=gp[i].nx)if(!bd[gp[i].v]){
        bd[gp[i].v]=1;
        if(!mth[gp[i].v]||fdp(mth[gp[i].v])){
            mth[gp[i].v]=v;
            return 1;
        }
    }
    return 0;
};
int hgy(int n){
    int rs=0,i;for(clr(mth),i=1;i<=n;++i){
        clr(bd);if(fdp(i))++rs;
    }
    return rs;
};
  
int ar[110],dr[210],cr[2][210],dn,n;
  
bool _ck(int n){
    if(n==1)return 0;int d=sqrt(n),i=2;for(;i<=d;++i)if(!(n%i))return 0;
    return 1;
};
  
bool cl(){
    if(scanf("%d",&n)==-1)return 0;
    int i,j,t,a,b,k;for(i=1;i<=n;scanf("%d",&ar[i++]));sort(ar+1,ar+n+1);n=unique(ar+1,ar+n+1)-ar-1;
    for(dn=1,dr[1]=ar[1],i=2;i<=n;++i){
        if(ar[i]==ar[i-1]+1)continue;
        dr[++dn]=ar[i-1]+1,dr[++dn]=ar[i];
    }
    dr[++dn]=ar[n]+1;
    for(a=b=0,i=1;i<=dn;++i){
        if(dr[i]&1)cr[1][++a]=dr[i];
        else
            cr[0][++b]=dr[i];
    }
    for(cnt=0,clr(hd),i=1;i<=a;++i)for(j=1;j<=b;++j)if(_ck(abs(cr[1][i]-cr[0][j])))
        psh(i,j);
    t=hgy(a);
    printf("%d\n",t+((a-t)/2*2)+((b-t)/2*2)+((a-t)%2*3));
    return 1;
};
  
int main() {
    while(cl());
    return 0;
};
```