#include<bits/stdc++.h>
using namespace std;
const int N = 205,M=10000008;
int n,y[N],x[N],pr[M],tot,k,fa[N],m;
bool vis[M],vv[N];
vector<int>S,T,v[N];
int dfs(int x)
{
    for(auto i:v[x])
    {
        if(!vv[i])
        {
            vv[i]=1;
            if(!fa[i]||dfs(fa[i]))
            {
                fa[i]=x;
                return 1;
            }
        }
    }
    return 0;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)scanf("%d",&y[i]);
    sort(y+1,y+n+1);
    x[m=1]=y[1];
    if(y[1]+1!=y[2])x[++m]=y[1]+1;
    for(int i=2;i<=n;i++)
    {
        if(y[i]!=y[i-1]+1)x[++m]=y[i];
        if(y[i]!=y[i+1]-1)x[++m]=y[i]+1;
    }
    n=m;vis[1]=1;
    for(int i=2;i<=10000000;i++)
    {
        if(!vis[i])pr[++tot]=i;
        for(int j=1;j<=tot&&i*pr[j]<=10000000;j++)
        {
            vis[i*pr[j]]=1;
            if(i%pr[j]==0)break;
        }
    }
    for(int i=1;i<=n;i++)
        if(x[i]&1)S.push_back(i);
        else T.push_back(i);
    for(auto i:S)for(auto j:T)if(!vis[abs(x[i]-x[j])])v[i].push_back(j);
    for(auto i:S)
    {
        memset(vv,0,sizeof(vv));
        if(dfs(i))k++;
    }
    printf("%d\n",k+(S.size()-k)/2*2+(T.size()-k)/2*2+((S.size()-k)%2)*3);
    return 0;
}

### Prompt

In cpp, your task is to solve 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 = 205,M=10000008;
int n,y[N],x[N],pr[M],tot,k,fa[N],m;
bool vis[M],vv[N];
vector<int>S,T,v[N];
int dfs(int x)
{
    for(auto i:v[x])
    {
        if(!vv[i])
        {
            vv[i]=1;
            if(!fa[i]||dfs(fa[i]))
            {
                fa[i]=x;
                return 1;
            }
        }
    }
    return 0;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++)scanf("%d",&y[i]);
    sort(y+1,y+n+1);
    x[m=1]=y[1];
    if(y[1]+1!=y[2])x[++m]=y[1]+1;
    for(int i=2;i<=n;i++)
    {
        if(y[i]!=y[i-1]+1)x[++m]=y[i];
        if(y[i]!=y[i+1]-1)x[++m]=y[i]+1;
    }
    n=m;vis[1]=1;
    for(int i=2;i<=10000000;i++)
    {
        if(!vis[i])pr[++tot]=i;
        for(int j=1;j<=tot&&i*pr[j]<=10000000;j++)
        {
            vis[i*pr[j]]=1;
            if(i%pr[j]==0)break;
        }
    }
    for(int i=1;i<=n;i++)
        if(x[i]&1)S.push_back(i);
        else T.push_back(i);
    for(auto i:S)for(auto j:T)if(!vis[abs(x[i]-x[j])])v[i].push_back(j);
    for(auto i:S)
    {
        memset(vv,0,sizeof(vv));
        if(dfs(i))k++;
    }
    printf("%d\n",k+(S.size()-k)/2*2+(T.size()-k)/2*2+((S.size()-k)%2)*3);
    return 0;
}

```