#include <cstring>
#include <cstdio>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
std::map<int, int> arr; 
int a[105], b[105], w[105][105], na, nb, from[105]; 
bool vis[105]; 
inline bool chk(int n)
{
	if (n <= 1)
		return false; 
	for (int i = 2; i * i <= n; i++)
	{
		if (!(n % i))
			return false; 
	}
	return true; 
}
bool dfs(int u)
{
	for (int v = 0; v < nb; v++)
	{
		if (vis[v] || !w[u][v])
			continue; 
		vis[v] = true; 
		if (-1 == from[v] || dfs(from[v]))
		{
			from[v] = u; 
			return true; 
		}
	}
	return false; 
}
int main()
{
	// freopen("ARC080-F.in", "r", stdin); 
	int n, ans = 0; 
	scanf("%d", &n); 
	for (int i = 0; i < n; i++)
	{
		int x; 
		scanf("%d", &x); 
		arr[x] ^= 1; 
		arr[x + 1] ^= 1; 
	}
	for (auto it : arr)
	{
		if (it.second)
			(it.first & 1 ? a[na++] : b[nb++]) = it.first; 
	}
	for (int i = 0; i < na; i++)
	{
		for (int j = 0; j < nb; j++)
			w[i][j] = chk(my_abs(a[i] - b[j])); 
	}
	memset(from, -1, sizeof(from)); 
	for (int i = 0; i < n; i++)
	{
		memset(vis, false, sizeof(vis)); 
		ans += dfs(i); 
	}
	printf("%d\n", ans + ((na - ans) / 2 + (nb - ans) / 2) * 2 + (na - ans & 1) * 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 <cstring>
#include <cstdio>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
std::map<int, int> arr; 
int a[105], b[105], w[105][105], na, nb, from[105]; 
bool vis[105]; 
inline bool chk(int n)
{
	if (n <= 1)
		return false; 
	for (int i = 2; i * i <= n; i++)
	{
		if (!(n % i))
			return false; 
	}
	return true; 
}
bool dfs(int u)
{
	for (int v = 0; v < nb; v++)
	{
		if (vis[v] || !w[u][v])
			continue; 
		vis[v] = true; 
		if (-1 == from[v] || dfs(from[v]))
		{
			from[v] = u; 
			return true; 
		}
	}
	return false; 
}
int main()
{
	// freopen("ARC080-F.in", "r", stdin); 
	int n, ans = 0; 
	scanf("%d", &n); 
	for (int i = 0; i < n; i++)
	{
		int x; 
		scanf("%d", &x); 
		arr[x] ^= 1; 
		arr[x + 1] ^= 1; 
	}
	for (auto it : arr)
	{
		if (it.second)
			(it.first & 1 ? a[na++] : b[nb++]) = it.first; 
	}
	for (int i = 0; i < na; i++)
	{
		for (int j = 0; j < nb; j++)
			w[i][j] = chk(my_abs(a[i] - b[j])); 
	}
	memset(from, -1, sizeof(from)); 
	for (int i = 0; i < n; i++)
	{
		memset(vis, false, sizeof(vis)); 
		ans += dfs(i); 
	}
	printf("%d\n", ans + ((na - ans) / 2 + (nb - ans) / 2) * 2 + (na - ans & 1) * 3);
	return 0; 
}

```