#include<bits/stdc++.h>
using namespace std;
bool bo[10001000],vis[410];
int st[410],mp[410][410],part[410],top,js0,js1;
bool isprime(int p)
{
	if ((p<=2)||(!(p&1))) return false;
	for (int i=2;i*i<=p;i++) if (p%i==0) return false;
	return true;
}
bool search(int s)
{
	vis[s]=true;
	for (int i=1;i<=top;i++) if (mp[s][i])
	{
		if (!part[i]) {part[i]=s;return true;}
		else if ((!vis[part[i]])&&(search(part[i]))) {part[i]=s;return true;}
	}
	return false;
}
int main()
{
	int n;scanf("%d",&n);
	for (int i=1;i<=n;i++) {int w;scanf("%d",&w);bo[w]=true;}
	for (int i=1;i<=10000001;i++) if (bo[i]^bo[i-1]) {st[++top]=i;if (i&1) js1++;else js0++;}
	for (int i=1;i<=top;i++) if (st[i]&1)
	for (int j=1;j<=top;j++) if (isprime(abs(st[i]-st[j]))) mp[i][j]=1;
	int sum=0;
	for (int i=1;i<=top;i++) if (st[i]&1)
	{
		memset(vis,0,sizeof(vis));
		sum+=search(i);
	}
	js0-=sum;js1-=sum;
	cout<<sum+js0+js1+(js0&js1&1)<<endl;
}
### Prompt

Please provide a Cpp coded solution 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;
bool bo[10001000],vis[410];
int st[410],mp[410][410],part[410],top,js0,js1;
bool isprime(int p)
{
	if ((p<=2)||(!(p&1))) return false;
	for (int i=2;i*i<=p;i++) if (p%i==0) return false;
	return true;
}
bool search(int s)
{
	vis[s]=true;
	for (int i=1;i<=top;i++) if (mp[s][i])
	{
		if (!part[i]) {part[i]=s;return true;}
		else if ((!vis[part[i]])&&(search(part[i]))) {part[i]=s;return true;}
	}
	return false;
}
int main()
{
	int n;scanf("%d",&n);
	for (int i=1;i<=n;i++) {int w;scanf("%d",&w);bo[w]=true;}
	for (int i=1;i<=10000001;i++) if (bo[i]^bo[i-1]) {st[++top]=i;if (i&1) js1++;else js0++;}
	for (int i=1;i<=top;i++) if (st[i]&1)
	for (int j=1;j<=top;j++) if (isprime(abs(st[i]-st[j]))) mp[i][j]=1;
	int sum=0;
	for (int i=1;i<=top;i++) if (st[i]&1)
	{
		memset(vis,0,sizeof(vis));
		sum+=search(i);
	}
	js0-=sum;js1-=sum;
	cout<<sum+js0+js1+(js0&js1&1)<<endl;
}
```