#include <bits/stdc++.h>
#define RI register int

using namespace std;

int Notprime[10000005], Prime[10000005], tot;
void Euler(int MAX) {
  Notprime[1] = 1;
  for (RI i = 2; i <= MAX; ++i) {
    if (!Notprime[i]) Prime[++tot] = i;
    for (RI j = 1; j <= tot && Prime[j] * i <= MAX; ++j) {
      Notprime[i * Prime[j]] = 1;
      if (i % Prime[j] == 0) break;
    }
  }
}

int const MAXN = 505;
struct Edges {
  int to, next;
} e[MAXN * MAXN];
int a[MAXN], odd[MAXN], even[MAXN], cnt1, cnt2;
int vis[MAXN], fa[MAXN], head[MAXN], ttott;

inline void Add(int k) { k & 1 ? odd[++cnt1] = k : even[++cnt2] = k; }
inline void addedge(int from, int to) {
  e[++ttott] = (Edges){to, head[from]};
  head[from] = ttott;
}

bool xyl(int k) {
  if (vis[k]) return 0;
  vis[k] = 1;
  for (RI i = head[k]; i; i = e[i].next)
    if (!fa[e[i].to] || xyl(fa[e[i].to])) {
      fa[e[i].to] = k;
      return 1;
    }
  return 0;
}

int main() {
//  freopen("prime.in", "r", stdin);
//  freopen("prime.out", "w", stdout);
  Euler(1e7);
  int n; scanf("%d", &n);
  for (RI i = 1; i <= n; ++i) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  int last = a[1];
  for (RI i = 2; i <= n; ++i)
    if (a[i] != a[i - 1] + 1)
      Add(last), Add(a[i - 1] + 1), last = a[i];
  Add(last), Add(a[n] + 1);
  for (RI i = 1; i <= cnt1; ++i)
    for (RI j = 1; j <= cnt2; ++j)
      if (!Notprime[abs(odd[i] - even[j])])
        addedge(i, j);
  int Sucs = 0;
  for (RI i = 1; i <= cnt1; ++i, memset(vis, 0, sizeof(vis)))
    if (xyl(i)) ++Sucs;
  int ans = Sucs; cnt1 -= Sucs, cnt2 -= Sucs;
  ans += cnt1 + cnt2;
  ans += cnt1 & 1;
  printf("%d\n", 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 <bits/stdc++.h>
#define RI register int

using namespace std;

int Notprime[10000005], Prime[10000005], tot;
void Euler(int MAX) {
  Notprime[1] = 1;
  for (RI i = 2; i <= MAX; ++i) {
    if (!Notprime[i]) Prime[++tot] = i;
    for (RI j = 1; j <= tot && Prime[j] * i <= MAX; ++j) {
      Notprime[i * Prime[j]] = 1;
      if (i % Prime[j] == 0) break;
    }
  }
}

int const MAXN = 505;
struct Edges {
  int to, next;
} e[MAXN * MAXN];
int a[MAXN], odd[MAXN], even[MAXN], cnt1, cnt2;
int vis[MAXN], fa[MAXN], head[MAXN], ttott;

inline void Add(int k) { k & 1 ? odd[++cnt1] = k : even[++cnt2] = k; }
inline void addedge(int from, int to) {
  e[++ttott] = (Edges){to, head[from]};
  head[from] = ttott;
}

bool xyl(int k) {
  if (vis[k]) return 0;
  vis[k] = 1;
  for (RI i = head[k]; i; i = e[i].next)
    if (!fa[e[i].to] || xyl(fa[e[i].to])) {
      fa[e[i].to] = k;
      return 1;
    }
  return 0;
}

int main() {
//  freopen("prime.in", "r", stdin);
//  freopen("prime.out", "w", stdout);
  Euler(1e7);
  int n; scanf("%d", &n);
  for (RI i = 1; i <= n; ++i) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  int last = a[1];
  for (RI i = 2; i <= n; ++i)
    if (a[i] != a[i - 1] + 1)
      Add(last), Add(a[i - 1] + 1), last = a[i];
  Add(last), Add(a[n] + 1);
  for (RI i = 1; i <= cnt1; ++i)
    for (RI j = 1; j <= cnt2; ++j)
      if (!Notprime[abs(odd[i] - even[j])])
        addedge(i, j);
  int Sucs = 0;
  for (RI i = 1; i <= cnt1; ++i, memset(vis, 0, sizeof(vis)))
    if (xyl(i)) ++Sucs;
  int ans = Sucs; cnt1 -= Sucs, cnt2 -= Sucs;
  ans += cnt1 + cnt2;
  ans += cnt1 & 1;
  printf("%d\n", ans);
  return 0;
}
```