#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 210;
const int M = 10000010;
int prime[M], not_prime[M], tot_prime;
int xi[N], A[N], B[N], totA, totB;
int V[N][N], pA[N], vA[N];
void insert(int t)
{
    if (t & 1) A[++ totA] = t;
    else B[++ totB] = t;
}
int dfs(int t)
{
    vA[t] = 1;
    for (int i = 1; i <= totB; ++ i) if (V[t][i] && !vA[pA[i]])
        if (!pA[i] || dfs(pA[i]))
            return pA[i] = t, 1;
    return 0;
}
int main()
{
    not_prime[1] = 1;
    for (int i = 2; i < M; ++ i)
    {
        if (!not_prime[i]) prime[++ tot_prime] = i;
        for (int j = 1; j <= tot_prime && i * prime[j] < M; ++ j)
        {
            not_prime[i * prime[j]] = 1;
            if (i % prime[j] == 0) break;
        }
    }
    cin >> n;
    for (int i = 1; i <= n; ++ i) cin >> xi[i];
    xi[0] = -1;
    for (int i = 1; i <= n; ++ i)
    {
        if (xi[i] - xi[i - 1] != 1) insert(xi[i]);
        if (xi[i + 1] - xi[i] != 1) insert(xi[i] + 1);
    }
    for (int a = 1; a <= totA; ++ a)
        for (int b = 1; b <= totB; ++ b)
            if (!not_prime[abs(A[a] - B[b])])
                V[a][b] = 1;
    int match = 0;
    for (int i = 1; i <= totA; ++ i)
    {
        for (int j = 1; j <= totA; ++ j) vA[j] = 0;
        if (dfs(i)) match ++;
    }
    int ans = match + (totA - match) / 2 * 2 + (totB - match) / 2 * 2 + (totA - match) % 2 * 3;
    cout << ans;
}

### 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>
using namespace std;
int n;
const int N = 210;
const int M = 10000010;
int prime[M], not_prime[M], tot_prime;
int xi[N], A[N], B[N], totA, totB;
int V[N][N], pA[N], vA[N];
void insert(int t)
{
    if (t & 1) A[++ totA] = t;
    else B[++ totB] = t;
}
int dfs(int t)
{
    vA[t] = 1;
    for (int i = 1; i <= totB; ++ i) if (V[t][i] && !vA[pA[i]])
        if (!pA[i] || dfs(pA[i]))
            return pA[i] = t, 1;
    return 0;
}
int main()
{
    not_prime[1] = 1;
    for (int i = 2; i < M; ++ i)
    {
        if (!not_prime[i]) prime[++ tot_prime] = i;
        for (int j = 1; j <= tot_prime && i * prime[j] < M; ++ j)
        {
            not_prime[i * prime[j]] = 1;
            if (i % prime[j] == 0) break;
        }
    }
    cin >> n;
    for (int i = 1; i <= n; ++ i) cin >> xi[i];
    xi[0] = -1;
    for (int i = 1; i <= n; ++ i)
    {
        if (xi[i] - xi[i - 1] != 1) insert(xi[i]);
        if (xi[i + 1] - xi[i] != 1) insert(xi[i] + 1);
    }
    for (int a = 1; a <= totA; ++ a)
        for (int b = 1; b <= totB; ++ b)
            if (!not_prime[abs(A[a] - B[b])])
                V[a][b] = 1;
    int match = 0;
    for (int i = 1; i <= totA; ++ i)
    {
        for (int j = 1; j <= totA; ++ j) vA[j] = 0;
        if (dfs(i)) match ++;
    }
    int ans = match + (totA - match) / 2 * 2 + (totB - match) / 2 * 2 + (totA - match) % 2 * 3;
    cout << ans;
}

```