#include <bits/stdc++.h>
using namespace std;

#define MAXN 10000010
#define X first
#define Y second

typedef long long ll;

int N, n, m;
bool flag[MAXN];
int p[MAXN], x[200], y[200], link[200], vis[200];

vector<int> E[200], lis, a;

bool Find(int x)
{
	for (int i = 0; i < E[x].size(); ++i)
	{
		int y = E[x][i];
		if (vis[y]) continue;
		vis[y] = true;
		if (!link[y] || Find(link[y]))
		{
			link[y] = x;
			return true;
		}
	}
	return false;
}

int Hungary()
{
	int res = 0;
	for (int i = 1; i <= n; ++i)
	{
		memset(vis, 0, sizeof(vis));
		res += Find(i);
	}
	return res;
}

int main()
{
	//freopen("in.in", "r", stdin);
	//freopen("out.out", "w", stdout);
	
	flag[1] = true;
	for (int i = 2;  i < MAXN; ++i)
	{
		if (!flag[i]) p[++p[0]] = i;
		for (int j = 1; j <= p[0] && i * p[j] < MAXN; ++j)
		{
			flag[i * p[j]] = true;
			if (i % p[j] == 0)
				break;
		}
	}
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i)
	{
		int x; 
		scanf("%d", &x);
		lis.push_back(x);
	}
	sort(lis.begin(), lis.end());
	for (int i = 0; i < lis.size();)
	{
		int j = i;
		while (j + 1 < lis.size() && lis[j + 1] == lis[i] + j + 1 - i)
			++j;
		a.push_back(lis[i]);
		a.push_back(lis[j] + 1);
		i = j + 1;
	}
	sort(a.begin(), a.end());
	a.erase(unique(a.begin(), a.end()), a.end());
	for (int i = 0; i < a.size(); ++i)
	{
		if (a[i] & 1) x[++n] = a[i];
		else y[++m] = a[i];
		//cout << i << " " << a[i] << endl;
	}
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
		{
			int t = abs(x[i] - y[j]);
			if ((t & 1) && !flag[t])
				E[i].push_back(j);
		}
	
	int k = Hungary();
	int ans = k + ((n - k) / 2 + (m - k) / 2) * 2 + ((n - k) & 1) * 3;
	printf("%d\n", ans);
	return 0;
}
### Prompt

Develop a solution in CPP to the problem described below:

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 MAXN 10000010
#define X first
#define Y second

typedef long long ll;

int N, n, m;
bool flag[MAXN];
int p[MAXN], x[200], y[200], link[200], vis[200];

vector<int> E[200], lis, a;

bool Find(int x)
{
	for (int i = 0; i < E[x].size(); ++i)
	{
		int y = E[x][i];
		if (vis[y]) continue;
		vis[y] = true;
		if (!link[y] || Find(link[y]))
		{
			link[y] = x;
			return true;
		}
	}
	return false;
}

int Hungary()
{
	int res = 0;
	for (int i = 1; i <= n; ++i)
	{
		memset(vis, 0, sizeof(vis));
		res += Find(i);
	}
	return res;
}

int main()
{
	//freopen("in.in", "r", stdin);
	//freopen("out.out", "w", stdout);
	
	flag[1] = true;
	for (int i = 2;  i < MAXN; ++i)
	{
		if (!flag[i]) p[++p[0]] = i;
		for (int j = 1; j <= p[0] && i * p[j] < MAXN; ++j)
		{
			flag[i * p[j]] = true;
			if (i % p[j] == 0)
				break;
		}
	}
	scanf("%d", &N);
	for (int i = 1; i <= N; ++i)
	{
		int x; 
		scanf("%d", &x);
		lis.push_back(x);
	}
	sort(lis.begin(), lis.end());
	for (int i = 0; i < lis.size();)
	{
		int j = i;
		while (j + 1 < lis.size() && lis[j + 1] == lis[i] + j + 1 - i)
			++j;
		a.push_back(lis[i]);
		a.push_back(lis[j] + 1);
		i = j + 1;
	}
	sort(a.begin(), a.end());
	a.erase(unique(a.begin(), a.end()), a.end());
	for (int i = 0; i < a.size(); ++i)
	{
		if (a[i] & 1) x[++n] = a[i];
		else y[++m] = a[i];
		//cout << i << " " << a[i] << endl;
	}
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= m; ++j)
		{
			int t = abs(x[i] - y[j]);
			if ((t & 1) && !flag[t])
				E[i].push_back(j);
		}
	
	int k = Hungary();
	int ans = k + ((n - k) / 2 + (m - k) / 2) * 2 + ((n - k) & 1) * 3;
	printf("%d\n", ans);
	return 0;
}
```