#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
 
int n,x,ans,tmp,v[10000005];
int a[505],cnt1,b[505],cnt2;
int edge[505][505],r[505];
bool pri[10000005],vis[505];
 
void get_prime(int maxn){
    memset(pri,true,sizeof(pri));
    pri[0]=pri[1]=false;
    for(int i=2;i<=maxn;i++){
        if(!pri[i])continue;
        for(int j=2;i*j<=maxn;j++){
            pri[i*j]=false;
        }
    }
}
 
bool find(int x){
    for(int i=1;i<=cnt2;i++)
        if(edge[x][i]&&!vis[i]){
            vis[i]=true;
            if(!r[i]||find(r[i]))
                return r[i]=x,true;
        }
    return false;
}
 
int main(){
    scanf("%d",&n);
    int maxn=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&x);
        maxn=max(maxn,x);
        v[x]^=1,v[x+1]^=1;
    }
    for(int i=1;i<=maxn+1;i++)
        if(v[i]){
            if(i&1)a[++cnt1]=i;
            else b[++cnt2]=i;
        }
    get_prime(maxn);
    for(int i=1;i<=cnt1;i++)
    for(int j=1;j<=cnt2;j++){
        if(pri[abs(a[i]-b[j])])edge[i][j]=1;
    }
    for(int i=1;i<=cnt1;i++){
        memset(vis,0,sizeof(vis));
        if(find(i))tmp++;
    }
    ans+=tmp;
    cnt1-=tmp,cnt2-=tmp;
    ans+=2*(cnt1/2)+2*(cnt2/2);
    if(cnt1&1)ans+=3;
    printf("%d",ans);
}
### Prompt

Your challenge is to write a Cpp solution to 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<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
 
int n,x,ans,tmp,v[10000005];
int a[505],cnt1,b[505],cnt2;
int edge[505][505],r[505];
bool pri[10000005],vis[505];
 
void get_prime(int maxn){
    memset(pri,true,sizeof(pri));
    pri[0]=pri[1]=false;
    for(int i=2;i<=maxn;i++){
        if(!pri[i])continue;
        for(int j=2;i*j<=maxn;j++){
            pri[i*j]=false;
        }
    }
}
 
bool find(int x){
    for(int i=1;i<=cnt2;i++)
        if(edge[x][i]&&!vis[i]){
            vis[i]=true;
            if(!r[i]||find(r[i]))
                return r[i]=x,true;
        }
    return false;
}
 
int main(){
    scanf("%d",&n);
    int maxn=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&x);
        maxn=max(maxn,x);
        v[x]^=1,v[x+1]^=1;
    }
    for(int i=1;i<=maxn+1;i++)
        if(v[i]){
            if(i&1)a[++cnt1]=i;
            else b[++cnt2]=i;
        }
    get_prime(maxn);
    for(int i=1;i<=cnt1;i++)
    for(int j=1;j<=cnt2;j++){
        if(pri[abs(a[i]-b[j])])edge[i][j]=1;
    }
    for(int i=1;i<=cnt1;i++){
        memset(vis,0,sizeof(vis));
        if(find(i))tmp++;
    }
    ans+=tmp;
    cnt1-=tmp,cnt2-=tmp;
    ans+=2*(cnt1/2)+2*(cnt2/2);
    if(cnt1&1)ans+=3;
    printf("%d",ans);
}
```