#include<cstdio>
const int N=1005,INF=~0u>>2;
int b[N],n,vis[N],lk[N],even[N],odd[N],even_num,odd_num,ans,k,tot,tim,v[N][N];
int abs(int x){return x>0?x:-x;}
bool find(int x){
	for(int i=1;i<=even_num;++i){
		if(v[x][i]&&vis[i]!=tim){
			vis[i]=tim;
			if(!lk[i]||find(lk[i])) return lk[i]=x,1;
		}
	}
	return 0;
}
//bool find(int x){
//	vis[x]=tim;
//	for(int i=1;i<=even_num;++i){
//		if(v[x][i]&&vis[lk[i]]!=tim){
//			if(!lk[i]||find(lk[i])) return lk[i]=x,1;
//		}
//	}
//	return 0;
//}
//bool find(int x){
//	for(int i=head[x];i;i=edge[i].nxt){
//		if(vis[edge[i].to]!=tim){
//			vis[edge[i].to]=tim;
//			if(!lk[edge[i].to]||find(edge[i].to)){
//				lk[edge[i].to]=x;
//				return 1;
//			}
//		}
//	}
//	return 0;
//}
bool check(int x){
	if(x==1) return 0;
	for(int i=2;i*i<=x;++i){
		if(x%i==0) return 0;
	}
	return 1;
}
void solve(int x){
	if(x&1) odd[++odd_num]=x;
	else even[++even_num]=x;
}
int main(){
//	freopen("ex.in","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&b[i]);b[0]=-1;
	for(int i=1;i<=n;++i){
		if(b[i]!=b[i-1]+1) solve(b[i]);
		if(b[i]+1!=b[i+1]) solve(b[i]+1);
	}
	for(int i=1;i<=odd_num;++i)
		for(int j=1;j<=even_num;++j)
			if(check(abs(even[j]-odd[i]))) v[i][j]=1;
	for(int i=1;i<=odd_num;++i){
		tim++;
		if(find(i)) k++;
	}
	ans=k+((even_num-k)/2+(odd_num-k)/2)*2+((odd_num-k)%2)*3;
	printf("%d",ans);
	return 0;
}
### Prompt

Create a solution in CPP for 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>
const int N=1005,INF=~0u>>2;
int b[N],n,vis[N],lk[N],even[N],odd[N],even_num,odd_num,ans,k,tot,tim,v[N][N];
int abs(int x){return x>0?x:-x;}
bool find(int x){
	for(int i=1;i<=even_num;++i){
		if(v[x][i]&&vis[i]!=tim){
			vis[i]=tim;
			if(!lk[i]||find(lk[i])) return lk[i]=x,1;
		}
	}
	return 0;
}
//bool find(int x){
//	vis[x]=tim;
//	for(int i=1;i<=even_num;++i){
//		if(v[x][i]&&vis[lk[i]]!=tim){
//			if(!lk[i]||find(lk[i])) return lk[i]=x,1;
//		}
//	}
//	return 0;
//}
//bool find(int x){
//	for(int i=head[x];i;i=edge[i].nxt){
//		if(vis[edge[i].to]!=tim){
//			vis[edge[i].to]=tim;
//			if(!lk[edge[i].to]||find(edge[i].to)){
//				lk[edge[i].to]=x;
//				return 1;
//			}
//		}
//	}
//	return 0;
//}
bool check(int x){
	if(x==1) return 0;
	for(int i=2;i*i<=x;++i){
		if(x%i==0) return 0;
	}
	return 1;
}
void solve(int x){
	if(x&1) odd[++odd_num]=x;
	else even[++even_num]=x;
}
int main(){
//	freopen("ex.in","r",stdin);
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&b[i]);b[0]=-1;
	for(int i=1;i<=n;++i){
		if(b[i]!=b[i-1]+1) solve(b[i]);
		if(b[i]+1!=b[i+1]) solve(b[i]+1);
	}
	for(int i=1;i<=odd_num;++i)
		for(int j=1;j<=even_num;++j)
			if(check(abs(even[j]-odd[i]))) v[i][j]=1;
	for(int i=1;i<=odd_num;++i){
		tim++;
		if(find(i)) k++;
	}
	ans=k+((even_num-k)/2+(odd_num-k)/2)*2+((odd_num-k)%2)*3;
	printf("%d",ans);
	return 0;
}
```