#include<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int e[201][201];
int vis[201];
int match[201];
int tot1=0,tot2=0;
bool find(int u)
{
	for(int i=1;i<=tot2;i++)
	{
		if(vis[i]==0&&e[u][i])
		{
			vis[i]=1;
			if(!match[i]||find(match[i]))
			{
				match[i]=u;
				return true;
			}
		}
	}
	return false;
}
bool isprime(int x)
{
	if(x==1) return false;
	for(int i=2;i<=sqrt(x);i++)
		if(x%i==0)
			return false;
	return true;
}
int x[201];
int odd[201];
int even[201];
signed main()
{
	int n;
	scanf("%d",&n);
	if(n==1){printf("3");return 0;}
	for(int i=1;i<=n;i++)
		scanf("%d",&x[i]);
	for(int i=1;i<=n;i++)
	{
		if(i==1||x[i-1]!=x[i]-1)
		{
			if(x[i]%2==1) odd[++tot1]=x[i];
			else even[++tot2]=x[i];
		}
		if(i==n||x[i+1]!=x[i]+1)
		{
			if(x[i]%2==1) even[++tot2]=x[i]+1;
			else odd[++tot1]=x[i]+1;
		}
	}
	for(int i=1;i<=tot1;i++)
		for(int j=1;j<=tot2;j++)
			if(isprime(abs(odd[i]-even[j])))
				e[i][j]=1;
	int ans=0;
	for(int i=1;i<=tot1;i++)
	{
		memset(vis,0,sizeof(vis));
		if(find(i))
			ans++;
	}
	printf("%d",ans+(tot1-ans)/2*2+(tot2-ans)/2*2+(tot1-ans)%2*3);
	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<iostream>
#include<cstdio>
#include<queue>
#include<stack>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
using namespace std;
int e[201][201];
int vis[201];
int match[201];
int tot1=0,tot2=0;
bool find(int u)
{
	for(int i=1;i<=tot2;i++)
	{
		if(vis[i]==0&&e[u][i])
		{
			vis[i]=1;
			if(!match[i]||find(match[i]))
			{
				match[i]=u;
				return true;
			}
		}
	}
	return false;
}
bool isprime(int x)
{
	if(x==1) return false;
	for(int i=2;i<=sqrt(x);i++)
		if(x%i==0)
			return false;
	return true;
}
int x[201];
int odd[201];
int even[201];
signed main()
{
	int n;
	scanf("%d",&n);
	if(n==1){printf("3");return 0;}
	for(int i=1;i<=n;i++)
		scanf("%d",&x[i]);
	for(int i=1;i<=n;i++)
	{
		if(i==1||x[i-1]!=x[i]-1)
		{
			if(x[i]%2==1) odd[++tot1]=x[i];
			else even[++tot2]=x[i];
		}
		if(i==n||x[i+1]!=x[i]+1)
		{
			if(x[i]%2==1) even[++tot2]=x[i]+1;
			else odd[++tot1]=x[i]+1;
		}
	}
	for(int i=1;i<=tot1;i++)
		for(int j=1;j<=tot2;j++)
			if(isprime(abs(odd[i]-even[j])))
				e[i][j]=1;
	int ans=0;
	for(int i=1;i<=tot1;i++)
	{
		memset(vis,0,sizeof(vis));
		if(find(i))
			ans++;
	}
	printf("%d",ans+(tot1-ans)/2*2+(tot2-ans)/2*2+(tot1-ans)%2*3);
	return 0;
}

```