#include <bits/stdc++.h> //hsl2363

#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define ll long long

using namespace std;

#define N 5005
#define M 10000005

int n, tot;
int prime[M], a[N];
bool notprime[M], vis[N];
int odd[N], even[N], cnt[3];
int fir[N], nx[N * N], to[N * N], match[N];

inline void init() {
    int MAX = 1e7;
    notprime[1] = 1;
    notprime[1] = 1;
    for (int i = 2; i <= MAX; ++i) {
        if (!notprime[i]) prime[++tot] = i;
        for (int j = 1; j <= tot && prime[j] * i <= MAX; ++j) {
            notprime[i * prime[j]] = 1;
            if (i % prime[j] == 0) break;
        }
    }
}

inline void Add(int x) { x & 1 ? odd[++cnt[1]] = x : even[++cnt[2]] = x; }

inline void add(int _, int __) {
    nx[++tot] = fir[_];
    fir[_] = tot;
    to[tot] = __;
}

bool dfs(int x) {
    if (vis[x]) return false;
    vis[x] = 1;
    for (int i = fir[x]; i; i = nx[i]) {
        int toi = to[i];
        if (!match[toi] || dfs(match[toi])) {
            match[toi] = x;
            return true;
        }
    }
    return false;
}

int main() {
    init();
    scanf ("%d", &n);
    rep (i, 1, n) scanf ("%d", &a[i]);
    sort(a + 1, a + n + 1);
    int last = a[1];
    rep (i, 2, n) if (a[i] != a[i - 1] + 1) Add(last), Add(a[i - 1] + 1), last = a[i];
    Add(last), Add(a[n] + 1);
//    rep (i, 1, cnt[1]) printf("%d%c", odd[i], " \n"[i == cnt[1]]);
//    rep (i, 1, cnt[2]) printf("%d%c", even[i], " \n"[i == cnt[2]]);
    rep (i, 1, cnt[1]) rep (j, 1, cnt[2]) if (!notprime[abs(odd[i] - even[j])])  add(i, j);
    int res = 0;
    rep (i, 1, cnt[1]) {
        memset(vis, 0, sizeof vis);
        if (dfs(i)) ++res;
    }
    int ans = res; cnt[1] -= res, cnt[2] -= res;
    ans += cnt[1] + cnt[2] + (cnt[1] & 1);
    printf("%d\n", ans);
    return 0;
}

### Prompt

Generate a Cpp solution 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 <bits/stdc++.h> //hsl2363

#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define ll long long

using namespace std;

#define N 5005
#define M 10000005

int n, tot;
int prime[M], a[N];
bool notprime[M], vis[N];
int odd[N], even[N], cnt[3];
int fir[N], nx[N * N], to[N * N], match[N];

inline void init() {
    int MAX = 1e7;
    notprime[1] = 1;
    notprime[1] = 1;
    for (int i = 2; i <= MAX; ++i) {
        if (!notprime[i]) prime[++tot] = i;
        for (int j = 1; j <= tot && prime[j] * i <= MAX; ++j) {
            notprime[i * prime[j]] = 1;
            if (i % prime[j] == 0) break;
        }
    }
}

inline void Add(int x) { x & 1 ? odd[++cnt[1]] = x : even[++cnt[2]] = x; }

inline void add(int _, int __) {
    nx[++tot] = fir[_];
    fir[_] = tot;
    to[tot] = __;
}

bool dfs(int x) {
    if (vis[x]) return false;
    vis[x] = 1;
    for (int i = fir[x]; i; i = nx[i]) {
        int toi = to[i];
        if (!match[toi] || dfs(match[toi])) {
            match[toi] = x;
            return true;
        }
    }
    return false;
}

int main() {
    init();
    scanf ("%d", &n);
    rep (i, 1, n) scanf ("%d", &a[i]);
    sort(a + 1, a + n + 1);
    int last = a[1];
    rep (i, 2, n) if (a[i] != a[i - 1] + 1) Add(last), Add(a[i - 1] + 1), last = a[i];
    Add(last), Add(a[n] + 1);
//    rep (i, 1, cnt[1]) printf("%d%c", odd[i], " \n"[i == cnt[1]]);
//    rep (i, 1, cnt[2]) printf("%d%c", even[i], " \n"[i == cnt[2]]);
    rep (i, 1, cnt[1]) rep (j, 1, cnt[2]) if (!notprime[abs(odd[i] - even[j])])  add(i, j);
    int res = 0;
    rep (i, 1, cnt[1]) {
        memset(vis, 0, sizeof vis);
        if (dfs(i)) ++res;
    }
    int ans = res; cnt[1] -= res, cnt[2] -= res;
    ans += cnt[1] + cnt[2] + (cnt[1] & 1);
    printf("%d\n", ans);
    return 0;
}

```