#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=1e5;
int ne[N],he[N],a[N],vis[N],g[N],t[N],tot,b1[N],x,y,b2[N];
void ad(int x,int y)
{
	tot++;
	ne[tot]=he[x];
	he[x]=tot;
	t[tot]=y;
}
void put(int v)
{
	if (v&1) 
	{
		x++;
		b1[x]=v;
	} else
	{
		y++;
		b2[y]=v;
	}
}
int pd(int x)
{
	if (x%2==0) return 0;
	if (x==1) return 0;
	for (int i=2;i<=sqrt(x);i++) if (x%i==0) return 0;
	return 1;
}
int dfs(int x)
{
	if (vis[x]==tot) return 0;
	vis[x]=tot;
	int i=he[x];
	while (i)
	{
		if (g[t[i]]==0||dfs(g[t[i]])) 
		{
			g[t[i]]=x;
			return 1;
		}
		i=ne[i];
	}
	return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
    put(a[1]-1);
	for (int i=2;i<=n;i++) 
	{
		if (a[i]-a[i-1]!=1) 
		{
			put(a[i-1]);
			put(a[i]-1);
		}
	}
	put(a[n]);
	for (int i=1;i<=x;i++) for (int j=1;j<=y;j++) if (pd(abs(b2[j]-b1[i]))) ad(i,j+x);
	int ans=0;
	for (int i=1;i<=x;i++) 
	{
		tot++;
		ans+=dfs(i);
	}
	x-=ans;
	y-=ans;
	if (x&1) 
	{
		ans+=3;
		x--;
		y--;
	}
	ans+=x+y;
	printf("%d\n",ans); 
}
### Prompt

Please create a solution in cpp 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<cmath>
#include<algorithm>
using namespace std;
const int N=1e5;
int ne[N],he[N],a[N],vis[N],g[N],t[N],tot,b1[N],x,y,b2[N];
void ad(int x,int y)
{
	tot++;
	ne[tot]=he[x];
	he[x]=tot;
	t[tot]=y;
}
void put(int v)
{
	if (v&1) 
	{
		x++;
		b1[x]=v;
	} else
	{
		y++;
		b2[y]=v;
	}
}
int pd(int x)
{
	if (x%2==0) return 0;
	if (x==1) return 0;
	for (int i=2;i<=sqrt(x);i++) if (x%i==0) return 0;
	return 1;
}
int dfs(int x)
{
	if (vis[x]==tot) return 0;
	vis[x]=tot;
	int i=he[x];
	while (i)
	{
		if (g[t[i]]==0||dfs(g[t[i]])) 
		{
			g[t[i]]=x;
			return 1;
		}
		i=ne[i];
	}
	return 0;
}
int main()
{
	int n;
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
    put(a[1]-1);
	for (int i=2;i<=n;i++) 
	{
		if (a[i]-a[i-1]!=1) 
		{
			put(a[i-1]);
			put(a[i]-1);
		}
	}
	put(a[n]);
	for (int i=1;i<=x;i++) for (int j=1;j<=y;j++) if (pd(abs(b2[j]-b1[i]))) ad(i,j+x);
	int ans=0;
	for (int i=1;i<=x;i++) 
	{
		tot++;
		ans+=dfs(i);
	}
	x-=ans;
	y-=ans;
	if (x&1) 
	{
		ans+=3;
		x--;
		y--;
	}
	ans+=x+y;
	printf("%d\n",ans); 
}
```