#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int n, c, val, x[209], match[209]; bool p[10000009], used[209]; vector<int> g[209];
bool augment(int pos) {
	used[pos] = true;
	for (int i : g[pos]) {
		if (match[i] < 0 || !used[match[i]] && augment(match[i])) {
			match[pos] = i;
			match[i] = pos;
			return true;
		}
	}
	return false;
}
int bipartite_matching() {
	int res = 0;
	fill(match, match + c, -1);
	for (int i = 0; i < c; i++) {
		if (match[i] < 0) {
			fill(used, used + c, false);
			if (augment(i)) res++;
		}
	}
	return res;
}
int main() {
	for (int i = 3; i <= 10000000; i += 2) p[i] = true;
	for (int i = 3; i * i <= 10000000; i += 2) {
		if (!p[i]) continue;
		for (int j = i * i; j <= 10000000; j += i) p[j] = false;
	}
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> val;
		if (c == 0 || val != x[c - 1]) x[c++] = val;
		else c--;
		x[c++] = val + 1;
	}
	int cnt = 0;
	for (int i = 0; i < c; i++) {
		if (x[i] % 2 == 0) cnt++;
	}
	for (int i = 0; i < c; i++) {
		for (int j = i + 1; j < c; j++) {
			if (p[x[j] - x[i]]) {
				g[i].push_back(j);
				g[j].push_back(i);
			}
		}
	}
	int ret = bipartite_matching();
	cout << c / 2 + (c / 2 - ret) + (cnt - ret) % 2 << endl;
	return 0;
}
### Prompt

Your challenge is to write 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 <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int n, c, val, x[209], match[209]; bool p[10000009], used[209]; vector<int> g[209];
bool augment(int pos) {
	used[pos] = true;
	for (int i : g[pos]) {
		if (match[i] < 0 || !used[match[i]] && augment(match[i])) {
			match[pos] = i;
			match[i] = pos;
			return true;
		}
	}
	return false;
}
int bipartite_matching() {
	int res = 0;
	fill(match, match + c, -1);
	for (int i = 0; i < c; i++) {
		if (match[i] < 0) {
			fill(used, used + c, false);
			if (augment(i)) res++;
		}
	}
	return res;
}
int main() {
	for (int i = 3; i <= 10000000; i += 2) p[i] = true;
	for (int i = 3; i * i <= 10000000; i += 2) {
		if (!p[i]) continue;
		for (int j = i * i; j <= 10000000; j += i) p[j] = false;
	}
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> val;
		if (c == 0 || val != x[c - 1]) x[c++] = val;
		else c--;
		x[c++] = val + 1;
	}
	int cnt = 0;
	for (int i = 0; i < c; i++) {
		if (x[i] % 2 == 0) cnt++;
	}
	for (int i = 0; i < c; i++) {
		for (int j = i + 1; j < c; j++) {
			if (p[x[j] - x[i]]) {
				g[i].push_back(j);
				g[j].push_back(i);
			}
		}
	}
	int ret = bipartite_matching();
	cout << c / 2 + (c / 2 - ret) + (cnt - ret) % 2 << endl;
	return 0;
}
```