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

const int MAXN = 2e2 + 5;
const int MAXM = 1e7 + 5;

int N;
int a[MAXM];
vector <int> v[2];
vector <int> E[MAXN];
bool bio[MAXN];
int conn[MAXN];

void load() {
	scanf("%d", &N);
	while (N--) {
		int x;
		scanf("%d", &x);
		a[x] = 1;
	}
}

bool dfs(int x) {
	if (bio[x])
		return false;
	bio[x] = true;
	for (auto it : E[x])
		if (conn[it] == -1 || dfs(conn[it])) {
			conn[it] = x;
			return true;
		}
	return false;
}

bool prime(int x) {
	if (x == 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (!(x % i))
			return false;
	return true;
}

int solve() {
	memset(conn, -1, sizeof conn);
	for (int i = MAXM - 1; i; i--) {
		a[i] ^= a[i - 1];
		if (a[i])
			v[i % 2].push_back(i);
	}
	
	for (int i = 0; i < v[0].size(); i++)
		for (int j = 0; j < v[1].size(); j++)
			if (prime(abs(v[0][i] - v[1][j]))) 
				E[i].push_back(j);
	
	int match = 0;
	for (int i = 0; i < v[0].size(); i++) {
		memset(bio, false, sizeof bio);
		match += dfs(i);
	}
	
	return v[0].size() + v[1].size() - match + (v[0].size() - match) % 2;
}

int main() {
	load();
	printf("%d\n", solve());
	return 0;
}
### Prompt

In Cpp, your task is to solve 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 <cstring>
#include <algorithm>
#include <vector>
using namespace std;

const int MAXN = 2e2 + 5;
const int MAXM = 1e7 + 5;

int N;
int a[MAXM];
vector <int> v[2];
vector <int> E[MAXN];
bool bio[MAXN];
int conn[MAXN];

void load() {
	scanf("%d", &N);
	while (N--) {
		int x;
		scanf("%d", &x);
		a[x] = 1;
	}
}

bool dfs(int x) {
	if (bio[x])
		return false;
	bio[x] = true;
	for (auto it : E[x])
		if (conn[it] == -1 || dfs(conn[it])) {
			conn[it] = x;
			return true;
		}
	return false;
}

bool prime(int x) {
	if (x == 1)
		return false;
	for (int i = 2; i * i <= x; i++)
		if (!(x % i))
			return false;
	return true;
}

int solve() {
	memset(conn, -1, sizeof conn);
	for (int i = MAXM - 1; i; i--) {
		a[i] ^= a[i - 1];
		if (a[i])
			v[i % 2].push_back(i);
	}
	
	for (int i = 0; i < v[0].size(); i++)
		for (int j = 0; j < v[1].size(); j++)
			if (prime(abs(v[0][i] - v[1][j]))) 
				E[i].push_back(j);
	
	int match = 0;
	for (int i = 0; i < v[0].size(); i++) {
		memset(bio, false, sizeof bio);
		match += dfs(i);
	}
	
	return v[0].size() + v[1].size() - match + (v[0].size() - match) % 2;
}

int main() {
	load();
	printf("%d\n", solve());
	return 0;
}
```