#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
using namespace std;
const int maxn=101;

int n,a[maxn];
vector<int> q,odd,eve;
vector<int> po[maxn*2],pe[maxn*2];
int to,te,s;
bool vis[maxn*2];
int match[maxn*2];

bool prime(int p)
{
	if (p<=2) return false;
	for(int i=2;i<=sqrt(p);i++)
		if (p%i==0) return false;
	return true;
}

bool calc(int p)
{
	for(int i=0;i<po[p].size();i++)
	{
		int nxt=po[p][i];
		if (vis[nxt]) continue;
		vis[nxt]=true;
		
		if (!match[nxt] || calc(match[nxt]))
		{
			match[nxt]=p;
			return true;
		}
	}
	return false;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	
	q.push_back(a[1]);
	for(int i=1;i<n;i++)
	{
		if (a[i]+1<a[i+1])
		{
			q.push_back(a[i]+1);
			q.push_back(a[i+1]);
		}
	}
	q.push_back(a[n]+1);
	
	odd.push_back(0);
	eve.push_back(0);
	for(int i=0;i<q.size();i++)
	{
		if (q[i]%2) odd.push_back(q[i]),to++;
		else eve.push_back(q[i]),te++;
	}
	
	for(int i=1;i<=to;i++)
	{
		for(int j=1;j<=te;j++)
		{
			if (prime(abs(odd[i]-eve[j])))
			{
				po[i].push_back(j);
				pe[j].push_back(i);
			}
		}
	}
	
	s=0;
	for(int i=1;i<=to;i++)
	{
		for(int j=1;j<=te;j++)
			vis[j]=false;
		if (calc(i)) s++;
	}
	
	int ans=s+((to-s)/2+(te-s)/2)*2+(to-s)%2*3;
	printf("%d\n",ans);
	return 0;
}
### Prompt

Your task is to create 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 <algorithm>
#include <vector>
#include <cmath>
using namespace std;
const int maxn=101;

int n,a[maxn];
vector<int> q,odd,eve;
vector<int> po[maxn*2],pe[maxn*2];
int to,te,s;
bool vis[maxn*2];
int match[maxn*2];

bool prime(int p)
{
	if (p<=2) return false;
	for(int i=2;i<=sqrt(p);i++)
		if (p%i==0) return false;
	return true;
}

bool calc(int p)
{
	for(int i=0;i<po[p].size();i++)
	{
		int nxt=po[p][i];
		if (vis[nxt]) continue;
		vis[nxt]=true;
		
		if (!match[nxt] || calc(match[nxt]))
		{
			match[nxt]=p;
			return true;
		}
	}
	return false;
}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	
	q.push_back(a[1]);
	for(int i=1;i<n;i++)
	{
		if (a[i]+1<a[i+1])
		{
			q.push_back(a[i]+1);
			q.push_back(a[i+1]);
		}
	}
	q.push_back(a[n]+1);
	
	odd.push_back(0);
	eve.push_back(0);
	for(int i=0;i<q.size();i++)
	{
		if (q[i]%2) odd.push_back(q[i]),to++;
		else eve.push_back(q[i]),te++;
	}
	
	for(int i=1;i<=to;i++)
	{
		for(int j=1;j<=te;j++)
		{
			if (prime(abs(odd[i]-eve[j])))
			{
				po[i].push_back(j);
				pe[j].push_back(i);
			}
		}
	}
	
	s=0;
	for(int i=1;i<=to;i++)
	{
		for(int j=1;j<=te;j++)
			vis[j]=false;
		if (calc(i)) s++;
	}
	
	int ans=s+((to-s)/2+(te-s)/2)*2+(to-s)%2*3;
	printf("%d\n",ans);
	return 0;
}
```