#include <bits/stdc++.h>

using namespace std;

inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}

const int maxn = 100 + 15;
const int Maxsz = 2e7;
const int inf = 1e9 + 7;

int Prime[Maxsz + 1] , Primelen , Vis[Maxsz + 1] , Pf[Maxsz + 1] , Have[Maxsz + 5] , n , Used[maxn << 1] , Link[maxn];
vector < int > odd , even , Edge[maxn << 1];


void Init(){
	for(int i = 2 ; i <= Maxsz ; ++ i){
		if( !Vis[i] )
			Prime[Primelen ++] = i;
		for(int j = 0 ; j < Primelen && Prime[j] * i <= Maxsz ; ++ j){
			Vis[i * Prime[j]] = 1;
			if( i % Prime[j] == 0 ) break;
		}
	}
}

bool Dfs( int x ){
	for(auto && v : Edge[x]){
		if( Used[v] ) continue;
		Used[v] = 1;
		if( Link[v] == -1 || Dfs( Link[v] ) ){
			Link[v] = x;
			return true;
		}
	}
	return false;
}

int main( int argc , char * argv[] ){
	Init();
	n = read();
	for(int i = 1 ; i <= n ; ++ i){
		int x = read();
		Have[x] = 1;
	}
	for(int i = 1 ; i <= Maxsz ; ++ i){
		if( Have[i] ^ Have[i - 1] ){
			if( i & 1 ) odd.emplace_back( i );
			else even.emplace_back( i );
		} 
	}
	Vis[1] = 1;
	for(int i = 0 ; i < odd.size() ; ++ i)
		for(int j = 0 ; j < even.size() ; ++ j)
			if( ( abs( odd[i] - even[j] ) & 1 ) && Vis[ abs( odd[i] - even[j] ) ] == 0 )
				Edge[i].emplace_back( j );
	memset( Link , -1 , sizeof( Link ) );
	int K = 0;
	for(int i = 0 ; i < odd.size() ; ++ i){
		memset( Used , 0 , sizeof( Used ) );
		K += Dfs( i );
	}
	int ret = K + ( ( odd.size() - K ) / 2 + ( even.size() - K ) / 2 ) * 2 + ( odd.size() - K ) % 2 * 3;
	printf( "%d\n" , ret );
	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 <bits/stdc++.h>

using namespace std;

inline int read(){int x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}return x*f;}

const int maxn = 100 + 15;
const int Maxsz = 2e7;
const int inf = 1e9 + 7;

int Prime[Maxsz + 1] , Primelen , Vis[Maxsz + 1] , Pf[Maxsz + 1] , Have[Maxsz + 5] , n , Used[maxn << 1] , Link[maxn];
vector < int > odd , even , Edge[maxn << 1];


void Init(){
	for(int i = 2 ; i <= Maxsz ; ++ i){
		if( !Vis[i] )
			Prime[Primelen ++] = i;
		for(int j = 0 ; j < Primelen && Prime[j] * i <= Maxsz ; ++ j){
			Vis[i * Prime[j]] = 1;
			if( i % Prime[j] == 0 ) break;
		}
	}
}

bool Dfs( int x ){
	for(auto && v : Edge[x]){
		if( Used[v] ) continue;
		Used[v] = 1;
		if( Link[v] == -1 || Dfs( Link[v] ) ){
			Link[v] = x;
			return true;
		}
	}
	return false;
}

int main( int argc , char * argv[] ){
	Init();
	n = read();
	for(int i = 1 ; i <= n ; ++ i){
		int x = read();
		Have[x] = 1;
	}
	for(int i = 1 ; i <= Maxsz ; ++ i){
		if( Have[i] ^ Have[i - 1] ){
			if( i & 1 ) odd.emplace_back( i );
			else even.emplace_back( i );
		} 
	}
	Vis[1] = 1;
	for(int i = 0 ; i < odd.size() ; ++ i)
		for(int j = 0 ; j < even.size() ; ++ j)
			if( ( abs( odd[i] - even[j] ) & 1 ) && Vis[ abs( odd[i] - even[j] ) ] == 0 )
				Edge[i].emplace_back( j );
	memset( Link , -1 , sizeof( Link ) );
	int K = 0;
	for(int i = 0 ; i < odd.size() ; ++ i){
		memset( Used , 0 , sizeof( Used ) );
		K += Dfs( i );
	}
	int ret = K + ( ( odd.size() - K ) / 2 + ( even.size() - K ) / 2 ) * 2 + ( odd.size() - K ) % 2 * 3;
	printf( "%d\n" , ret );
	return 0;
}
```