#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e7 + 10;
const int maxm = 200 + 10;
int n;
bool flag[maxn];
int prime[maxn], cnt;
int a[maxm], vis[maxm], match[maxm], cur;
vector<int> odd, even, E[maxm];
void ins(int x)
{
	if(x & 1) odd.push_back(x);
	else even.push_back(x);
}
void sieve()
{
	flag[1] = 1;
	for(int i = 2; i < maxn; ++i)
	{
		if(!flag[i]) prime[++cnt] = i;
		for(int j = 1; j <= cnt && i * prime[j] < maxn; ++j)
		{
			flag[i * prime[j]] = 1;
			if(i % prime[j] == 0)
				break;
		}
	}
}
bool dfs(int now)
{
	for(auto v : E[now])
		if(vis[v] != cur)
		{
			vis[v] = cur;
			if(match[v] == -1 || dfs(match[v]))
			{
				match[v] = now;
				return true;
			}
		}
	return false;
}
void add(int u, int v)
{
	++u, ++v;
	v += odd.size();
	E[u].push_back(v);
}
int h()
{
	int ret = 0;
	memset(match, -1, sizeof match);
	for(int i = 1; i <= odd.size(); ++i)
	{
		cur = i;
		ret += dfs(i);
	}
	return ret;
}	
int main()
{
	sieve();
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	ins(a[1]);
	for(int i = 2; i <= n; ++i)
	{
		if(a[i] == a[i - 1] + 1)
			continue;
		ins(a[i - 1] + 1);
		ins(a[i]);
	}
	ins(a[n] + 1);
	for(int i = 0; i < odd.size(); ++i)
		for(int j = 0; j < even.size(); ++j)
			if(!flag[abs(odd[i] - even[j])])
				add(i, j);
	int ret = h();
	if((odd.size() - ret) & 1) --ret;
	int ans = odd.size() + even.size() - ret;
	printf("%d\n", ans);
	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 <bits/stdc++.h>
using namespace std;
const int maxn = 1e7 + 10;
const int maxm = 200 + 10;
int n;
bool flag[maxn];
int prime[maxn], cnt;
int a[maxm], vis[maxm], match[maxm], cur;
vector<int> odd, even, E[maxm];
void ins(int x)
{
	if(x & 1) odd.push_back(x);
	else even.push_back(x);
}
void sieve()
{
	flag[1] = 1;
	for(int i = 2; i < maxn; ++i)
	{
		if(!flag[i]) prime[++cnt] = i;
		for(int j = 1; j <= cnt && i * prime[j] < maxn; ++j)
		{
			flag[i * prime[j]] = 1;
			if(i % prime[j] == 0)
				break;
		}
	}
}
bool dfs(int now)
{
	for(auto v : E[now])
		if(vis[v] != cur)
		{
			vis[v] = cur;
			if(match[v] == -1 || dfs(match[v]))
			{
				match[v] = now;
				return true;
			}
		}
	return false;
}
void add(int u, int v)
{
	++u, ++v;
	v += odd.size();
	E[u].push_back(v);
}
int h()
{
	int ret = 0;
	memset(match, -1, sizeof match);
	for(int i = 1; i <= odd.size(); ++i)
	{
		cur = i;
		ret += dfs(i);
	}
	return ret;
}	
int main()
{
	sieve();
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i) scanf("%d", &a[i]);
	ins(a[1]);
	for(int i = 2; i <= n; ++i)
	{
		if(a[i] == a[i - 1] + 1)
			continue;
		ins(a[i - 1] + 1);
		ins(a[i]);
	}
	ins(a[n] + 1);
	for(int i = 0; i < odd.size(); ++i)
		for(int j = 0; j < even.size(); ++j)
			if(!flag[abs(odd[i] - even[j])])
				add(i, j);
	int ret = h();
	if((odd.size() - ret) & 1) --ret;
	int ans = odd.size() + even.size() - ret;
	printf("%d\n", ans);
	return 0;
}
	
	
```