#include <bits/stdc++.h>
using namespace std;
#define REP(I, A) for (int(I) = 0; (I) < (A); (I)++)
#define pb(I) push_back(I)
const int N = 10000000;

set<int> s, e;
vector<int> vx, vy, Gx[200];
int matl[1000], matr[1000];
bool vis[1000];

bool is_prime(int x) {
	if(x < 3) return false;
	for (int i = 3; i*i <= x; i++) if(x % i == 0) return false;
	return true;
}

bool dfs(int x) {
	for (int v : Gx[x]) {
		if (!vis[v]) {
			vis[v] = true;
			if (matl[v] == -1 || dfs(matl[v])) {
				matl[v] = x;
				matr[x] = v;
				return true;
			}
		}
	}
	return false;
}

int domatch() {
	memset(matl, -1, sizeof(matl));
	memset(matr, -1, sizeof(matr));
	int cnt = 0;
	REP(i, vx.size()) {
		if (matr[i] != -1)
			continue;
		memset(vis, 0, sizeof(vis));
		cnt += dfs(i);
	}
	return cnt;
}

int main() {
	int n, x;
	scanf("%d", &n);
	REP(i, n) {
		scanf("%d", &x);
		s.insert(x);
	}
	for (int u : s) {
		if (!s.count(u - 1))
			e.insert(u);
		if (!s.count(u + 1))
			e.insert(u + 1);
	}
	for (int u : e)
		if (u & 1)
			vx.pb(u);
		else
			vy.pb(u);
	REP(i, vx.size())
	REP(j, vy.size())
	if (is_prime(abs(vx[i] - vy[j])))
		Gx[i].pb(j);
	int t = domatch();
	int l1 = vx.size() - t, l2 = vy.size() - t;
	int res = t;
	res += l1 / 2 * 2;
	res += l2 / 2 * 2;
	if (l1 % 2 == 1 && l2 % 2 == 1)
		res += 3;
	cout << res << endl;
	return 0;
}
### Prompt

Please create a solution in Cpp 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;
#define REP(I, A) for (int(I) = 0; (I) < (A); (I)++)
#define pb(I) push_back(I)
const int N = 10000000;

set<int> s, e;
vector<int> vx, vy, Gx[200];
int matl[1000], matr[1000];
bool vis[1000];

bool is_prime(int x) {
	if(x < 3) return false;
	for (int i = 3; i*i <= x; i++) if(x % i == 0) return false;
	return true;
}

bool dfs(int x) {
	for (int v : Gx[x]) {
		if (!vis[v]) {
			vis[v] = true;
			if (matl[v] == -1 || dfs(matl[v])) {
				matl[v] = x;
				matr[x] = v;
				return true;
			}
		}
	}
	return false;
}

int domatch() {
	memset(matl, -1, sizeof(matl));
	memset(matr, -1, sizeof(matr));
	int cnt = 0;
	REP(i, vx.size()) {
		if (matr[i] != -1)
			continue;
		memset(vis, 0, sizeof(vis));
		cnt += dfs(i);
	}
	return cnt;
}

int main() {
	int n, x;
	scanf("%d", &n);
	REP(i, n) {
		scanf("%d", &x);
		s.insert(x);
	}
	for (int u : s) {
		if (!s.count(u - 1))
			e.insert(u);
		if (!s.count(u + 1))
			e.insert(u + 1);
	}
	for (int u : e)
		if (u & 1)
			vx.pb(u);
		else
			vy.pb(u);
	REP(i, vx.size())
	REP(j, vy.size())
	if (is_prime(abs(vx[i] - vy[j])))
		Gx[i].pb(j);
	int t = domatch();
	int l1 = vx.size() - t, l2 = vy.size() - t;
	int res = t;
	res += l1 / 2 * 2;
	res += l2 / 2 * 2;
	if (l1 % 2 == 1 && l2 % 2 == 1)
		res += 3;
	cout << res << endl;
	return 0;
}
```