#include <cstdio>
#include <cstring>
#include<map>

inline int Abs(const int x) { return x >= 0 ? x : -x; }

int n, a[205], b[205], Mat[205], Ans;
bool G[205][205], Vis[205];
std::map<int, int> M;

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

bool DFS(int x)
{
	for (int y = 1; y <= n; ++y)
		if (!Vis[y] && G[x][y])
			if (Vis[y] = true, !Mat[y] || DFS(Mat[y]))
				return Mat[y] = x, true;
	return false;
}

int main()
{
	scanf("%d", &n);
	for (int i = 1, x; i <= n; ++i)scanf("%d", &x), M[x] ^= 1, M[x + 1] ^= 1;
	for (auto i : M)if (i.second)(i.first & 1 ? a[++ * a] : b[++ * b]) = i.first;
	for (int i = 1; i <= *a; ++i)
		for (int j = 1; j <= *b; ++j)
			G[i][j] = Prime(Abs(a[i] - b[j]));
	for (int i = 1; i <= *a; ++i)memset(Vis, 0, sizeof Vis), Ans += DFS(i);
	printf("%d\n", Ans + (*a - Ans) / 2 * 2 + (*b - Ans) / 2 * 2 + (*a - Ans) % 2 * 3);
	
	return 0;
}

### Prompt

Please formulate 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 <cstring>
#include<map>

inline int Abs(const int x) { return x >= 0 ? x : -x; }

int n, a[205], b[205], Mat[205], Ans;
bool G[205][205], Vis[205];
std::map<int, int> M;

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

bool DFS(int x)
{
	for (int y = 1; y <= n; ++y)
		if (!Vis[y] && G[x][y])
			if (Vis[y] = true, !Mat[y] || DFS(Mat[y]))
				return Mat[y] = x, true;
	return false;
}

int main()
{
	scanf("%d", &n);
	for (int i = 1, x; i <= n; ++i)scanf("%d", &x), M[x] ^= 1, M[x + 1] ^= 1;
	for (auto i : M)if (i.second)(i.first & 1 ? a[++ * a] : b[++ * b]) = i.first;
	for (int i = 1; i <= *a; ++i)
		for (int j = 1; j <= *b; ++j)
			G[i][j] = Prime(Abs(a[i] - b[j]));
	for (int i = 1; i <= *a; ++i)memset(Vis, 0, sizeof Vis), Ans += DFS(i);
	printf("%d\n", Ans + (*a - Ans) / 2 * 2 + (*b - Ans) / 2 * 2 + (*a - Ans) % 2 * 3);
	
	return 0;
}

```