#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>

using namespace std;

vector<int> prime,point[201],v1,v2;
int match[201],N,x,cnt;
bool check[10000001],rev[10000002],vis[201];

void sieve(){
	check[1]=true;for(int i=2;i<=10000000;++i){
		if(!check[i])prime.push_back(i);
		for(int j:prime){if(1ll*i*j>10000000)break;check[i*j]=true;if(i%j==0)break;}
	}
}

bool dfs(int x){
	for(int y:point[x])if(!vis[y]){vis[y]=true;if(match[y]<0||dfs(match[y])){match[y]=x;return true;}}
	return false;
}

int main(){
	sieve();
	scanf("%d",&N);for(int i=1;i<=N;++i)scanf("%d",&x),rev[x]^=true;
	for(int i=1;i<=10000001;++i)if(rev[i]!=rev[i-1])if(i&1)v1.push_back(i);else v2.push_back(i);
	for(int i=0;i<v1.size();++i)for(int j=0;j<v2.size();++j)if(!check[abs(v1[i]-v2[j])])point[i].push_back(j);
	memset(match,-1,sizeof(match));for(int i=0;i<v1.size();++i){memset(vis,false,sizeof(vis));if(dfs(i))++cnt;}
	printf("%d",cnt+(v1.size()-cnt>>1<<1)+(v2.size()-cnt>>1<<1)+((v1.size()-cnt)&1)*3);
}
### 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<iostream>
#include<cstdio>
#include<cstring>
#include<vector>

using namespace std;

vector<int> prime,point[201],v1,v2;
int match[201],N,x,cnt;
bool check[10000001],rev[10000002],vis[201];

void sieve(){
	check[1]=true;for(int i=2;i<=10000000;++i){
		if(!check[i])prime.push_back(i);
		for(int j:prime){if(1ll*i*j>10000000)break;check[i*j]=true;if(i%j==0)break;}
	}
}

bool dfs(int x){
	for(int y:point[x])if(!vis[y]){vis[y]=true;if(match[y]<0||dfs(match[y])){match[y]=x;return true;}}
	return false;
}

int main(){
	sieve();
	scanf("%d",&N);for(int i=1;i<=N;++i)scanf("%d",&x),rev[x]^=true;
	for(int i=1;i<=10000001;++i)if(rev[i]!=rev[i-1])if(i&1)v1.push_back(i);else v2.push_back(i);
	for(int i=0;i<v1.size();++i)for(int j=0;j<v2.size();++j)if(!check[abs(v1[i]-v2[j])])point[i].push_back(j);
	memset(match,-1,sizeof(match));for(int i=0;i<v1.size();++i){memset(vis,false,sizeof(vis));if(dfs(i))++cnt;}
	printf("%d",cnt+(v1.size()-cnt>>1<<1)+(v2.size()-cnt>>1<<1)+((v1.size()-cnt)&1)*3);
}
```