#include<iostream>
#include<cstdio>
#include<cstring>
using namespace std;
const int N=110*2;
bool f[10001000],fl[N][N],fla[N];
int n,p[1000100],cnt,a[N],cot,from[N],nj[N],no[N];
bool match(int x)
{
    if(fla[x]) return false;
    fla[x]=true;
    for(int i=1;i<=no[0];++i)
        if(fl[x][i]&&(from[i]==0||match(from[i])))
        {
            from[i]=x;
            return true;
        }
    return false;
}
void init()
{
    for(int i=2;i<=10000500;++i)
    {
        if(!f[i]) p[++cnt]=i;
            for(int j=1;j<=cnt&&p[j]*i<=10000050;++j)
            {
                f[p[j]*i]=true;
                if(i%p[j]==0) break;
            }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    init();
    f[1]=true;
    f[2]=false;
    cin>>n;
    int t=-10,t1;
    for(int i=1;i<=n;++i)
    {
        cin>>t1;
        if(t1-t!=1) 
        {
            a[cot++]=t+1;
            a[cot++]=t1;
        }
        t=t1;
    }
    a[cot]=t1+1;
    for(int i=1;i<=cot;++i)
    {
        if(a[i]%2)
            nj[++nj[0]]=a[i];
        else
            no[++no[0]]=a[i];
    }
    for(int i=1;i<=nj[0];++i)
        for(int j=1;j<=no[0];++j)
            fl[i][j]=!f[abs(nj[i]-no[j])];
    int ans=0;
    for(int i=1;i<=nj[0];++i)
    {
        memset(fla,false,sizeof(fla));
        if(match(i)) ans++;
    }
    cout<< ans+(nj[0]-ans)/2*2+(no[0]-ans)/2*2+(nj[0]-ans)%2*3 <<endl;
    return 0;
}
### Prompt

Construct a cpp code solution to the problem outlined:

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<cstring>
using namespace std;
const int N=110*2;
bool f[10001000],fl[N][N],fla[N];
int n,p[1000100],cnt,a[N],cot,from[N],nj[N],no[N];
bool match(int x)
{
    if(fla[x]) return false;
    fla[x]=true;
    for(int i=1;i<=no[0];++i)
        if(fl[x][i]&&(from[i]==0||match(from[i])))
        {
            from[i]=x;
            return true;
        }
    return false;
}
void init()
{
    for(int i=2;i<=10000500;++i)
    {
        if(!f[i]) p[++cnt]=i;
            for(int j=1;j<=cnt&&p[j]*i<=10000050;++j)
            {
                f[p[j]*i]=true;
                if(i%p[j]==0) break;
            }
    }
}
int main()
{
    ios::sync_with_stdio(false);
    init();
    f[1]=true;
    f[2]=false;
    cin>>n;
    int t=-10,t1;
    for(int i=1;i<=n;++i)
    {
        cin>>t1;
        if(t1-t!=1) 
        {
            a[cot++]=t+1;
            a[cot++]=t1;
        }
        t=t1;
    }
    a[cot]=t1+1;
    for(int i=1;i<=cot;++i)
    {
        if(a[i]%2)
            nj[++nj[0]]=a[i];
        else
            no[++no[0]]=a[i];
    }
    for(int i=1;i<=nj[0];++i)
        for(int j=1;j<=no[0];++j)
            fl[i][j]=!f[abs(nj[i]-no[j])];
    int ans=0;
    for(int i=1;i<=nj[0];++i)
    {
        memset(fla,false,sizeof(fla));
        if(match(i)) ans++;
    }
    cout<< ans+(nj[0]-ans)/2*2+(no[0]-ans)/2*2+(nj[0]-ans)%2*3 <<endl;
    return 0;
}
```