#include <cstdio>
#include <vector>
#include <cstring>
#include <cmath>
using namespace std;

const int MAX_N = 100 + 9;
const int MAX_M = 1e7;

int N, x, cnt, match[MAX_N * 2 + 9];//, V;
bool is_prime[MAX_M + 9], rev[MAX_M + 9], used[MAX_N * 2 + 9];
vector<int> primes, v1, v2, G[MAX_N * 2 + 9];

void sieve() {
	memset(is_prime, 1, sizeof(is_prime));
	is_prime[0] = is_prime[1] = 0;
	for (int i = 2; i <= MAX_M; i++) {
		if (is_prime[i]) primes.push_back(i);
		for (int j : primes) {
			if (1LL * i * j > MAX_M) break;
			is_prime[i * j] = false;
			if (i % j == 0) break;
		}
	}
}

bool dfs(int v) {
	for (int u : G[v]) {
		if (!used[u]) {
			used[u] = true;
			if (match[u] < 0 || dfs(match[u])) {
				match[u] = v;
				return true;
			}
		}
	}
	return false;
}

void bipartite_matching() {
	memset(match, -1, sizeof(match));
	for (int v = 0; v < v1.size(); v++) {
		memset(used, 0, sizeof(used));
		if (dfs(v)) cnt++;
	}
}

int main() {
	sieve();
	scanf("%d", &N); 
	for (int i = 1; i <= N; i++) scanf("%d", &x), rev[x] ^= true;
	for (int i = 1; i <= MAX_M + 1; 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++) {
			int m = abs(v1[i] - v2[j]);
			if (is_prime[m]) G[i].push_back(j);
		}
	}
//	V = v1.size() + v2.size();
	bipartite_matching();
	printf("%d", cnt + (v1.size() - cnt >> 1 << 1) + (v2.size() - cnt >> 1 << 1) + ((v1.size() - cnt) & 1) * 3);
	return 0;
}
### Prompt

Your task is to create 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>
using namespace std;

const int MAX_N = 100 + 9;
const int MAX_M = 1e7;

int N, x, cnt, match[MAX_N * 2 + 9];//, V;
bool is_prime[MAX_M + 9], rev[MAX_M + 9], used[MAX_N * 2 + 9];
vector<int> primes, v1, v2, G[MAX_N * 2 + 9];

void sieve() {
	memset(is_prime, 1, sizeof(is_prime));
	is_prime[0] = is_prime[1] = 0;
	for (int i = 2; i <= MAX_M; i++) {
		if (is_prime[i]) primes.push_back(i);
		for (int j : primes) {
			if (1LL * i * j > MAX_M) break;
			is_prime[i * j] = false;
			if (i % j == 0) break;
		}
	}
}

bool dfs(int v) {
	for (int u : G[v]) {
		if (!used[u]) {
			used[u] = true;
			if (match[u] < 0 || dfs(match[u])) {
				match[u] = v;
				return true;
			}
		}
	}
	return false;
}

void bipartite_matching() {
	memset(match, -1, sizeof(match));
	for (int v = 0; v < v1.size(); v++) {
		memset(used, 0, sizeof(used));
		if (dfs(v)) cnt++;
	}
}

int main() {
	sieve();
	scanf("%d", &N); 
	for (int i = 1; i <= N; i++) scanf("%d", &x), rev[x] ^= true;
	for (int i = 1; i <= MAX_M + 1; 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++) {
			int m = abs(v1[i] - v2[j]);
			if (is_prime[m]) G[i].push_back(j);
		}
	}
//	V = v1.size() + v2.size();
	bipartite_matching();
	printf("%d", cnt + (v1.size() - cnt >> 1 << 1) + (v2.size() - cnt >> 1 << 1) + ((v1.size() - cnt) & 1) * 3);
	return 0;
}
```