#include<cstdio>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
int n,tot,prime[11000000],nprime[11000000];
int ans,cnt1,cnt2,s[11000000];
int a[210],b[210],vis[410],match[410];
vector<int> vec[410];
char Getchar(){
    static char now[1<<20],*S,*T;
    if (T==S){
        T=(S=now)+fread(now,1,1<<20,stdin);
        if (T==S) return EOF;
    }
    return *S++;
}
int read(){
    int x=0,f=1;
    char ch=Getchar();
    while (ch<'0'||ch>'9'){
        if (ch=='-') f=-1;
        ch=Getchar();
    }
    while (ch<='9'&&ch>='0') x=x*10+ch-'0',ch=Getchar();
    return x*f;
}
bool dfs(int x){
	int y;
	for (int i=0;i<(int)vec[x].size();i++){
		y=vec[x][i];
		if (!vis[y]){
			vis[y]=true;
			if (!match[y]||dfs(match[y])){
				match[y]=x;
				return true;
			}
		}
	}
	return false;
}
int main(){
	for (int i=2;i<=10000001;i++){
		if (!nprime[i]) prime[++tot]=i;
		for (int j=1;j<=tot&&i*prime[j]<=10000001;j++){
			nprime[i*prime[j]]=true;
			if (i%prime[j]==0) break;
		}
	}
	n=read(); nprime[1]=1;
	for (int i=1;i<=n;i++) s[read()]=1;
	for (int i=1;i<=10000001;i++)
		if (s[i]!=s[i-1]){
			if (i&1) a[++cnt1]=i;
			else b[++cnt2]=i;
		}
	for (int i=1;i<=cnt1;i++)
		for (int j=1;j<=cnt2;j++)
			if (!nprime[abs(a[i]-b[j])])
				vec[i].push_back(j);
	for (int i=1;i<=cnt1;i++){
		memset(vis,false,sizeof(vis));
		ans+=dfs(i);
	}
	printf("%d\n",ans+(cnt1-ans)/2*2+(cnt2-ans)/2*2+((cnt1-ans)&1)*3);
	return 0;
}

### Prompt

Generate 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<cstdio>
#include<vector>
#include<cstring>
#include<cmath>
#include<cstdlib>
using namespace std;
int n,tot,prime[11000000],nprime[11000000];
int ans,cnt1,cnt2,s[11000000];
int a[210],b[210],vis[410],match[410];
vector<int> vec[410];
char Getchar(){
    static char now[1<<20],*S,*T;
    if (T==S){
        T=(S=now)+fread(now,1,1<<20,stdin);
        if (T==S) return EOF;
    }
    return *S++;
}
int read(){
    int x=0,f=1;
    char ch=Getchar();
    while (ch<'0'||ch>'9'){
        if (ch=='-') f=-1;
        ch=Getchar();
    }
    while (ch<='9'&&ch>='0') x=x*10+ch-'0',ch=Getchar();
    return x*f;
}
bool dfs(int x){
	int y;
	for (int i=0;i<(int)vec[x].size();i++){
		y=vec[x][i];
		if (!vis[y]){
			vis[y]=true;
			if (!match[y]||dfs(match[y])){
				match[y]=x;
				return true;
			}
		}
	}
	return false;
}
int main(){
	for (int i=2;i<=10000001;i++){
		if (!nprime[i]) prime[++tot]=i;
		for (int j=1;j<=tot&&i*prime[j]<=10000001;j++){
			nprime[i*prime[j]]=true;
			if (i%prime[j]==0) break;
		}
	}
	n=read(); nprime[1]=1;
	for (int i=1;i<=n;i++) s[read()]=1;
	for (int i=1;i<=10000001;i++)
		if (s[i]!=s[i-1]){
			if (i&1) a[++cnt1]=i;
			else b[++cnt2]=i;
		}
	for (int i=1;i<=cnt1;i++)
		for (int j=1;j<=cnt2;j++)
			if (!nprime[abs(a[i]-b[j])])
				vec[i].push_back(j);
	for (int i=1;i<=cnt1;i++){
		memset(vis,false,sizeof(vis));
		ans+=dfs(i);
	}
	printf("%d\n",ans+(cnt1-ans)/2*2+(cnt2-ans)/2*2+((cnt1-ans)&1)*3);
	return 0;
}

```