#include <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;

const int M = 1e7;
const int N = 2e2 + 10;
struct E {int v, nt;} e[N*N];
int n, c, cnt, tot, h[N], x[N], p[M+10], mask[N], used[N];

inline void add(int u, int v) {
	e[++tot] = (E){v, h[u]}, h[u] = tot;
	e[++tot] = (E){u, h[v]}, h[v] = tot;
}

template <class T> inline void in(T &x) {
	x = 0; int f = 1; char ch = getchar();
	for (; ch<'0' || ch>'9';) {if (ch=='-') f=-1; ch = getchar();}
	for (; ch>='0' && ch<='9';) x = x*10 + ch-'0', ch = getchar();
	x *= f;
}

inline void init() {
	for (int i = 3; i <= M; i += 2) p[i] = 1;
	for (int i = 3; i * i <= M; i += 2) {
		if (!p[i]) continue;
		for (int j = i * i; j <= M; j += i) p[j] = 0;
	}
}

inline int dfs(int x) {
	int v; used[x] = 1;
	for (int v, i = h[x]; i; i = e[i].nt)
		if (!mask[v = e[i].v] || (!used[mask[v]] && dfs(mask[v]))) {
			mask[v] = x, mask[x] = v; return 1;
		}
	return 0;
}

inline int match() {
	int res = 0;
	fill(mask + 1, mask + c + 1, 0);
	for (int i = 1; i <= c; ++i)
		if (!mask[i]) {
			fill(used + 1, used + c + 1, 0);
			if (dfs(i)) ++res;
		}
	return res;
}

inline void work() {
	int val; in(n);
	for (int i = 1; i <= n; ++i) {
		in(val);
		if (!c || val != x[c]) x[++c] = val;
		else --c;
		x[++c] = val + 1;
	}
	for (int i = 1; i <= c; ++i) if (x[i] % 2 == 0) ++cnt;
	for (int i = 1; i <= c; ++i)
		for (int j = i + 1; j <= c; ++j)
			if (p[x[j] - x[i]]) add(i, j);
	int ret = match();
	printf("%d\n", c / 2 + (c / 2 - ret) + (cnt - ret) % 2);
}

int main() {init(), work(); 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 <algorithm>
#include <iostream>
#include <cstdio>
using namespace std;

const int M = 1e7;
const int N = 2e2 + 10;
struct E {int v, nt;} e[N*N];
int n, c, cnt, tot, h[N], x[N], p[M+10], mask[N], used[N];

inline void add(int u, int v) {
	e[++tot] = (E){v, h[u]}, h[u] = tot;
	e[++tot] = (E){u, h[v]}, h[v] = tot;
}

template <class T> inline void in(T &x) {
	x = 0; int f = 1; char ch = getchar();
	for (; ch<'0' || ch>'9';) {if (ch=='-') f=-1; ch = getchar();}
	for (; ch>='0' && ch<='9';) x = x*10 + ch-'0', ch = getchar();
	x *= f;
}

inline void init() {
	for (int i = 3; i <= M; i += 2) p[i] = 1;
	for (int i = 3; i * i <= M; i += 2) {
		if (!p[i]) continue;
		for (int j = i * i; j <= M; j += i) p[j] = 0;
	}
}

inline int dfs(int x) {
	int v; used[x] = 1;
	for (int v, i = h[x]; i; i = e[i].nt)
		if (!mask[v = e[i].v] || (!used[mask[v]] && dfs(mask[v]))) {
			mask[v] = x, mask[x] = v; return 1;
		}
	return 0;
}

inline int match() {
	int res = 0;
	fill(mask + 1, mask + c + 1, 0);
	for (int i = 1; i <= c; ++i)
		if (!mask[i]) {
			fill(used + 1, used + c + 1, 0);
			if (dfs(i)) ++res;
		}
	return res;
}

inline void work() {
	int val; in(n);
	for (int i = 1; i <= n; ++i) {
		in(val);
		if (!c || val != x[c]) x[++c] = val;
		else --c;
		x[++c] = val + 1;
	}
	for (int i = 1; i <= c; ++i) if (x[i] % 2 == 0) ++cnt;
	for (int i = 1; i <= c; ++i)
		for (int j = i + 1; j <= c; ++j)
			if (p[x[j] - x[i]]) add(i, j);
	int ret = match();
	printf("%d\n", c / 2 + (c / 2 - ret) + (cnt - ret) % 2);
}

int main() {init(), work(); return 0;}
```