#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

const int maxn = 1e7+10;
const int maxm = 210;

int p[4100000],pri;
bool v[maxn];

void pre()
{
    for(int i=2;i<maxn;i++)
    {
        if(!v[i]) p[++pri]=i;
        for(int j=1,k=i*p[j];j<=pri;j++,k=i*p[j])
        {
            if(k>=maxn) break;
            v[k]=true;
            if(i%p[j]==0) break;
        }
    }v[1]=v[2]=true;
}

int n,m;
int a[maxm],b[maxm];
bool s[maxn];
int p1[maxm],p2[maxm];
int p1n,p2n;

bool mp[maxm][maxm],ev[maxm];
int match[maxm],bel[maxm];
bool Find(const int x)
{
    if(ev[x]) return false;
    ev[x]=true;
    for(int i=1;i<=p2n;i++) if(mp[x][i])
    {
        if(!bel[i]||Find(bel[i])) { bel[i]=x; return true; }
    }
    return false;
}

int main()
{
    pre();
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]),s[a[i]]=true;
    for(int i=1;i<maxn;i++)
        if(s[i]!=s[i-1]) b[++m]=i;

    for(int i=1;i<=m;i++)
    {
        if(b[i]&1) p1[++p1n]=b[i];
        else p2[++p2n]=b[i];
    }
    for(int i=1;i<=p1n;i++)
    {
        for(int j=1;j<=p2n;j++) if(!v[abs(p1[i]-p2[j])]) mp[i][j]=true;
    }
    int k=0;
    for(int i=1;i<=p1n;i++) if(!match[i])
    {
        for(int j=1;j<=p1n;j++) ev[j]=false;
        if(Find(i)) k++;
    }
    p1n-=k; p2n-=k;
    int re=k;
    re+=p1n/2*2+p2n/2*2;
    re+=p1n%2*3;
     printf("%d\n",re);
    return 0;
}

### Prompt

Please formulate 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<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

const int maxn = 1e7+10;
const int maxm = 210;

int p[4100000],pri;
bool v[maxn];

void pre()
{
    for(int i=2;i<maxn;i++)
    {
        if(!v[i]) p[++pri]=i;
        for(int j=1,k=i*p[j];j<=pri;j++,k=i*p[j])
        {
            if(k>=maxn) break;
            v[k]=true;
            if(i%p[j]==0) break;
        }
    }v[1]=v[2]=true;
}

int n,m;
int a[maxm],b[maxm];
bool s[maxn];
int p1[maxm],p2[maxm];
int p1n,p2n;

bool mp[maxm][maxm],ev[maxm];
int match[maxm],bel[maxm];
bool Find(const int x)
{
    if(ev[x]) return false;
    ev[x]=true;
    for(int i=1;i<=p2n;i++) if(mp[x][i])
    {
        if(!bel[i]||Find(bel[i])) { bel[i]=x; return true; }
    }
    return false;
}

int main()
{
    pre();
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]),s[a[i]]=true;
    for(int i=1;i<maxn;i++)
        if(s[i]!=s[i-1]) b[++m]=i;

    for(int i=1;i<=m;i++)
    {
        if(b[i]&1) p1[++p1n]=b[i];
        else p2[++p2n]=b[i];
    }
    for(int i=1;i<=p1n;i++)
    {
        for(int j=1;j<=p2n;j++) if(!v[abs(p1[i]-p2[j])]) mp[i][j]=true;
    }
    int k=0;
    for(int i=1;i<=p1n;i++) if(!match[i])
    {
        for(int j=1;j<=p1n;j++) ev[j]=false;
        if(Find(i)) k++;
    }
    p1n-=k; p2n-=k;
    int re=k;
    re+=p1n/2*2+p2n/2*2;
    re+=p1n%2*3;
     printf("%d\n",re);
    return 0;
}

```