#include<bits/stdc++.h>

#define mp make_pair
#define vi vector<int>
#define xx first
#define yy second
#define all(a) a.begin(), a.end()
#define vsort(v) sort(all(v))
#define UNIQUE(a)  sort(all(a)); a.erase(unique(all(a)), a.end())
#define clr(a,k) memset(a,k,sizeof a)
#define bclr(b) memset(b,false,sizeof b)
#define fr(i, a) for(i = 0; i < a; i++)
#define frr(i,a) for(i = a - 1; i >= 0, i--)
#define LL long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define vll vector<long long>
///***** bit *****///
#define check_bit(a, b) (a&(1<<b))
#define set_bit(a, b) (a|(1<<b))
#define total_bit(a) __builtin_popcount(a)

#define WRITE freopen("C:\\Users\\back_bencher\\Desktop\\output.txt","w",stdout)
#define use_cin  ios_base::sync_with_stdio(0); cin.tie(0);
#define READ  freopen("C:\\Users\\back_bencher\\Desktop\\input.txt","r",stdin)

///***** Input / Output *****///
#define s1(a) scanf("%d", &a)
#define s2(a, b) scanf("%d %d", &a, &b)
#define s3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define s4(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
#define p1(a) printf("%d", a)
#define p2(a, b) printf("%d %d", a, b)
#define p3(a, b, c) printf("%d %d %d", a, b, c)
#define eps 1e-9
#define deb cout<<"I am here"<<endl
#define MOD 1000000007
#define MAX (lim+7)
#define INF 100000000
#define PI acos(-1.0)

using namespace std;

///******* Template ********///

template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0)
    {
        T t=bigmod(p,e/2,M);
        return (t*t)%M;
    }
    return (bigmod(p,e-1,M)*p)%M;
}
template <class T> inline T gcd(T a,T b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}
template <class T> inline T modinverse(T a,T M)
{
    return bigmod(a,M-2,M);
}

/**
return (a * b) % m;
where a, b, m <= 10^18
**/
template <class T> inline T multimod(T a, T b, T m)
{
    T ans = 0ll;
    a%=m, b%=m;
    while(b)
    {
        if(b&1ll) ans = m - ans > a?(ans + a): (ans + a - m);
        b >>= 1ll;
        a = (m - a)>a?a+a:a+a-m;
    }
    return (T)ans;
}

///****** fast scan ends here ***********///

//int dr[] = {-1, 0, 1, 0};
//int dc[] = {0, 1, 0, -1}; /// 4 sides
//int dr[] = {-1, -1, 0, 1, 1, 1, 0, -1}; dc[] = {0, 1, 1, 1, 0, -1, -1, -1}; /// 8 sides

#define LEN(a) strlen(a)

#define MX 1000000000000000000ll
#define lim 2000000      /// 10^5

///***** Template ends here *****///
///********************* Code starts here ****************************

bool is[MAX];

void sieve()
{
    int sq = sqrt(MAX);
    is[1] = 1;
    int i, j;
    for(i = 4; i < MAX; i+=2) is[i] = 1;
    for(i = 3; i <= sq; i += 2)
    {
        if(!is[i])
        {
            for(j = i + i; j < MAX; j += i)
                is[j] = 1;
        }
    }

}

int arr[MAX];

int main()
{
    sieve();
    int i, j, k;
    int n, num, m, q;
    cin>>n;
    int cnt = 0;
    for(i = 0; i < n; i++)
    {
        cin>>arr[i];
        if(arr[i] == 1)
            cnt++;
    }
    if(cnt >= 2)
    {
        bool ck = 0;
        for(i = 0; i < n; i++)
        {
            if(arr[i] == 1) continue;
            if(is[ arr[i] + 1 ] == 0)
            {
                cout<<cnt+1<<endl;
                cout<<arr[i]<<" ";
                ck = 1;
                break;
            }
        }
        if(!ck)
            cout<<cnt<<endl;
        for(i = 0; i < cnt; i++)
            cout<<1<<" ";
            return 0;
    }
    else
    {
        for(i = 0; i < n; i++)
        {
            for(j = i + 1; j < n; j++)
            {
                if(! is[ arr[i]+arr[j] ])
                {
                    cout<<2<<endl;
                    cout<<arr[i]<<" "<<arr[j]<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<1<<endl;
    cout<<arr[0]<<endl;

    return 0;
}
/*

*/


#include<bits/stdc++.h>

#define mp make_pair
#define vi vector<int>
#define xx first
#define yy second
#define all(a) a.begin(), a.end()
#define vsort(v) sort(all(v))
#define UNIQUE(a)  sort(all(a)); a.erase(unique(all(a)), a.end())
#define clr(a,k) memset(a,k,sizeof a)
#define bclr(b) memset(b,false,sizeof b)
#define fr(i, a) for(i = 0; i < a; i++)
#define frr(i,a) for(i = a - 1; i >= 0, i--)
#define LL long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define vll vector<long long>
///***** bit *****///
#define check_bit(a, b) (a&(1<<b))
#define set_bit(a, b) (a|(1<<b))
#define total_bit(a) __builtin_popcount(a)

#define WRITE freopen("C:\\Users\\back_bencher\\Desktop\\output.txt","w",stdout)
#define use_cin  ios_base::sync_with_stdio(0); cin.tie(0);
#define READ  freopen("C:\\Users\\back_bencher\\Desktop\\input.txt","r",stdin)

///***** Input / Output *****///
#define s1(a) scanf("%d", &a)
#define s2(a, b) scanf("%d %d", &a, &b)
#define s3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define s4(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
#define p1(a) printf("%d", a)
#define p2(a, b) printf("%d %d", a, b)
#define p3(a, b, c) printf("%d %d %d", a, b, c)
#define eps 1e-9
#define deb cout<<"I am here"<<endl
#define MOD 1000000007
#define MAX (lim+7)
#define INF 100000000
#define PI acos(-1.0)

using namespace std;

///******* Template ********///

template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0)
    {
        T t=bigmod(p,e/2,M);
        return (t*t)%M;
    }
    return (bigmod(p,e-1,M)*p)%M;
}
template <class T> inline T gcd(T a,T b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}
template <class T> inline T modinverse(T a,T M)
{
    return bigmod(a,M-2,M);
}

/**
return (a * b) % m;
where a, b, m <= 10^18
**/
template <class T> inline T multimod(T a, T b, T m)
{
    T ans = 0ll;
    a%=m, b%=m;
    while(b)
    {
        if(b&1ll) ans = m - ans > a?(ans + a): (ans + a - m);
        b >>= 1ll;
        a = (m - a)>a?a+a:a+a-m;
    }
    return (T)ans;
}

///****** fast scan ends here ***********///

//int dr[] = {-1, 0, 1, 0};
//int dc[] = {0, 1, 0, -1}; /// 4 sides
//int dr[] = {-1, -1, 0, 1, 1, 1, 0, -1}; dc[] = {0, 1, 1, 1, 0, -1, -1, -1}; /// 8 sides

#define LEN(a) strlen(a)

#define MX 1000000000000000000ll
#define lim 2000000      /// 10^5

///***** Template ends here *****///
///********************* Code starts here ****************************

bool is[MAX];

void sieve()
{
    int sq = sqrt(MAX);
    is[1] = 1;
    int i, j;
    for(i = 4; i < MAX; i+=2) is[i] = 1;
    for(i = 3; i <= sq; i += 2)
    {
        if(!is[i])
        {
            for(j = i + i; j < MAX; j += i)
                is[j] = 1;
        }
    }

}

int arr[MAX];

int main()
{
    sieve();
    int i, j, k;
    int n, num, m, q;
    cin>>n;
    int cnt = 0;
    for(i = 0; i < n; i++)
    {
        cin>>arr[i];
        if(arr[i] == 1)
            cnt++;
    }
    if(cnt >= 2)
    {
        bool ck = 0;
        for(i = 0; i < n; i++)
        {
            if(arr[i] == 1) continue;
            if(is[ arr[i] + 1 ] == 0)
            {
                cout<<cnt+1<<endl;
                cout<<arr[i]<<" ";
                break;
            }
        }
        if(!ck)
            cout<<cnt<<endl;
        for(i = 0; i < cnt; i++)
            cout<<1<<" ";
            return 0;
    }
    else
    {
        for(i = 0; i < n; i++)
        {
            for(j = i + 1; j < n; j++)
            {
                if(! is[ arr[i]+arr[j] ])
                {
                    cout<<2<<endl;
                    cout<<arr[i]<<" "<<arr[j]<<endl;
                    return 0;
                }
            }
        }
    }
    cout<<arr[0]<<endl;

    return 0;
}
/*

*/


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;

int n;
vi a;
bitset<1000005> bs;

void sieve(ll n) {
    bs.set();
    for (ll i = 2; i <= n; i++) {
        if (bs[i]) {
            for (ll j = i * i; j <= n; j += i) bs[j] = 0;
        }
    }
}

bool isPrime(int k) {
    return bs[k];
}

void solve() {
    int ones = 0;
    int p = -1;
    for (int i = 0; i < a.size(); i++) {
        if (a[i] == 1) ones++;
        if (isPrime(1 + a[i]) && a[i] != 1) p = a[i];
    }
    int ans1 = p != -1 ? ones + 1 : ones;
    if (ans1 >= 2) {
        cout << ans1 << endl;
        if (p) cout << p << " ";
        for (int i = 0; i < ones; i++) {
            if (i) cout << " ";
            cout << 1;
        }
        cout << endl;
        return;
    }
    p = -1;
    for (int i = 0; i < a.size() - 1; i++) {
        for (int j = i + 1; j < a.size(); j++) {
            if (isPrime(a[i])) p = a[i];
            if (isPrime(a[i] + a[j])) {
                cout << 2 << endl;
                cout << a[i] << " " << a[j] << endl;
                return;
            }
        }
    }
    if (p == -1) {
        if (isPrime(a.back())) {
            cout << 1 << endl;
            cout << p << endl;
        }
        else {
            cout << 0 << endl;
        }
    }
    else {
        cout << 1 << endl;
        cout << p << endl;
    }
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sieve(1000000);
    int ans = 0;
    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;

int n;
vi a;
bitset<1000005> bs;

void sieve(ll n) {
    bs.set();
    for (ll i = 2; i <= n; i++) {
        if (bs[i]) {
            for (ll j = i * i; j <= n; j += i) bs[j] = 0;
        }
    }
}

bool isPrime(int k) {
    return bs[k];
}

void solve() {
    int ans1 = count(a.begin(), a.end(), 1);
    int prime = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] != 1 && isPrime(a[i] + 1)) {
            prime = a[i];
            ans1++;
            break;
        }
    }
    if (ans1 >= 2) {
        cout << ans1 << endl;
        if (prime) {
            cout << prime << " ";
            for (int i = 0; i < ans1 - 1; i++) {
                if (i) cout << " ";
                cout << 1;
            }
        }
        else {
            for (int i = 0; i < ans1; i++) {
                if (i) cout << " ";
                cout << 1;
            }
        }
        cout << endl;
    }
    else {
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if (isPrime(a[i] + a[j])) {
                    cout << 2 << endl;
                    cout << a[i] << " " << a[j] << endl;
                    return;
                }
            }
        }
        cout << 1 << endl;
        cout << a[0] << endl;
    }
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sieve(1000000);
    int ans = 0;
    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;

int n;
vi a;
vi b;
vi c;

bool ok(int k) {
    b = vi();
    for (int i = 0; i < n; i++) {
        if (k & (1 << i)) b.push_back(a[i]);
    }
    int sum;
    for (int i = 0; i < b.size() - 1; i++) {
        for (int j = i + 1; j < b.size(); j++) {
            sum = b[i] + b[j];
            if (sum == 2) return true;
            for (int x = 2; x * x <= sum; x++) {
                if (sum % x == 0) return false;
            }
        }
    }
    return true;
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans = 0;
    vi sol;
    for (int i = 1; i < (1 << n); i++) {
        if (ok(i)) {
            if (__builtin_popcount(i) > ans) {
                ans = __builtin_popcount(i);
                c = b;
            }
        }
    }
    cout << ans << endl;
    for (int i = 0; i < c.size(); i++) {
        if (i) cout << " ";
        cout << c[i];
    }
    cout << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;

int n;
vi a;
vi b;
vi c;

bool isPrime(int k) {
    if (k < 2) return false;
    if (k == 2) return true;
    for (int x = 2; x * x <= k; x++) {
        if (k % x == 0) return false;
    }
    return true;
}

bool ok(int k) {
    b = vi();
    for (int i = 0; i < n; i++) {
        if (k & (1 << i)) b.push_back(a[i]);
    }
    int sum;
    for (int i = 0; i < b.size() - 1; i++) {
        for (int j = i + 1; j < b.size(); j++) {
            sum = b[i] + b[j];
            if (!isPrime(sum)) return false;
        }
    }
    return true;
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans = 0;
    vi sol;
    for (int i = 1; i < (1 << n); i++) {
        if (ok(i)) {
            if (__builtin_popcount(i) > ans) {
                ans = __builtin_popcount(i);
                c = b;
            }
        }
    }
    cout << ans << endl;
    for (int i = 0; i < c.size(); i++) {
        if (i) cout << " ";
        cout << c[i];
    }
    cout << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;

int n;
vi a;
bitset<1000005> bs;

void sieve(ll n) {
    bs.set();
    for (ll i = 2; i <= n; i++) {
        if (bs[i]) {
            for (ll j = i * i; j <= n; j += i) bs[j] = 0;
        }
    }
}

bool isPrime(int k) {
    return bs[k];
}

void solve() {
    int ans1 = count(a.begin(), a.end(), 1);
    int prime = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] != 1 && isPrime(a[i] + 1)) {
            prime = a[i];
            ans1++;
            break;
        }
    }
    if (ans1 >= 2) {
        cout << ans1 << endl;
        if (prime) {
            cout << prime << " ";
            for (int i = 0; i < ans1 - 1; i++) {
                if (i) cout << " ";
                cout << 1;
            }
        }
        else {
            for (int i = 0; i < ans1; i++) {
                if (i) cout << " ";
                cout << 1;
            }
        }
        cout << endl;
    }
    else {
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if (isPrime(a[i] + a[j])) {
                    puts("asdasd");
                    cout << 2 << endl;
                    cout << a[i] << " " << a[j] << endl;
                    return;
                }
            }
        }
        cout << 1 << endl;
        cout << a[0] << endl;
    }
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sieve(1000000);
    int ans = 0;
    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;

int n;
vi a;
bitset<1000005> bs;

void sieve(ll n) {
    bs.set();
    for (ll i = 2; i <= n; i++) {
        if (bs[i]) {
            for (ll j = i * i; j <= n; j += i) bs[j] = 0;
        }
    }
}

bool isPrime(int k) {
    return bs[k];
}

void solve() {
    int ones = 0;
    int p = -1;
    for (int i = 0; i < a.size(); i++) {
        if (a[i] == 1) ones++;
        if (isPrime(1 + a[i]) && a[i] != 1) p = a[i];
    }
    int ans1 = p != -1 ? ones + 1 : ones;
    if (ans1 >= 2) {
        cout << p << " ";
        for (int i = 0; i < ones; i++) {
            if (i) cout << " ";
            cout << 1;
        }
        cout << endl;
        return;
    }
    p = -1;
    for (int i = 0; i < a.size() - 1; i++) {
        for (int j = i + 1; j < a.size(); j++) {
            if (isPrime(a[i])) p = a[i];
            if (isPrime(a[i] + a[j])) {
                cout << 2 << endl;
                cout << a[i] << " " << a[j] << endl;
                return;
            }
        }
    }
    if (p == -1) {
        if (isPrime(a.back())) {
            cout << 1 << endl;
            cout << p << endl;
        }
        else {
            cout << 0 << endl;
        }
    }
    else {
        cout << 1 << endl;
        cout << p << endl;
    }
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sieve(1000000);
    int ans = 0;
    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;

int n;
vi a;
bitset<2000005> bs;

void sieve(ll n) {
    bs.set();
    for (ll i = 2; i <= n; i++) {
        if (bs[i]) {
            for (ll j = i * i; j <= n; j += i) bs[j] = 0;
        }
    }
}

bool isPrime(int k) {
    return bs[k];
}

void solve() {
    int ans1 = count(a.begin(), a.end(), 1);
    int prime = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] != 1 && isPrime(a[i] + 1)) {
            prime = a[i];
            ans1++;
            break;
        }
    }
    if (ans1 >= 2) {
        cout << ans1 << endl;
        if (prime) {
            cout << prime << " ";
            for (int i = 0; i < ans1 - 1; i++) {
                if (i) cout << " ";
                cout << 1;
            }
        }
        else {
            for (int i = 0; i < ans1; i++) {
                if (i) cout << " ";
                cout << 1;
            }
        }
        cout << endl;
    }
    else {
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if (isPrime(a[i] + a[j])) {
                    cout << 2 << endl;
                    cout << a[i] << " " << a[j] << endl;
                    return;
                }
            }
        }
        cout << 1 << endl;
        cout << a[0] << endl;
    }
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sieve(2000000);
    int ans = 0;
    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;

int n;
vi a;
bitset<1000005> bs;

void sieve(ll n) {
    bs.set();
    for (ll i = 2; i <= n; i++) {
        if (bs[i]) {
            for (ll j = i * i; j <= n; j += i) bs[j] = 0;
        }
    }
}

bool isPrime(int k) {
    return bs[k];
}

void solve() {
    int ones = 0;
    int p = -1;
    for (int i = 0; i < a.size(); i++) {
        if (a[i] == 1) ones++;
        if (isPrime(1 + a[i]) && a[i] != 1) p = a[i];
    }
    int ans1 = p != -1 ? ones + 1 : ones;
    if (ans1 >= 2) {
        cout << ans1 << endl;
        if (p != -1) cout << p << " ";
        for (int i = 0; i < ones; i++) {
            if (i) cout << " ";
            cout << 1;
        }
        cout << endl;
        return;
    }
    p = -1;
    for (int i = 0; i < a.size() - 1; i++) {
        for (int j = i + 1; j < a.size(); j++) {
            if (isPrime(a[i])) p = a[i];
            if (isPrime(a[i] + a[j])) {
                cout << 2 << endl;
                cout << a[i] << " " << a[j] << endl;
                return;
            }
        }
    }
    if (p == -1) {
        if (isPrime(a.back())) {
            p = a.back();
            cout << 1 << endl;
            cout << p << endl;
        }
        else {
            cout << 0 << endl;
        }
    }
    else {
        cout << 1 << endl;
        cout << p << endl;
    }
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sieve(1000000);
    int ans = 0;
    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;

int n;
vi a;
vi b;
vi c;

bool isPrime(int k) {
    if (k < 2) return false;
    if (k == 2) return true;
    for (int x = 2; x * x <= k; x++) {
        if (k % x == 0) return false;
    }
    return true;
}

bool ok(int k) {
    b = vi();
    for (int i = 0; i < n; i++) {
        if (k & (1 << i)) b.push_back(a[i]);
    }
    int sum;
    if (k == 207) {
        for (int i = 0; i < b.size(); i++) {
            cout << b[i];
            cout << " ";
        }
        cout << endl;
    }
    for (int i = 0; i < b.size() - 1; i++) {
        for (int j = i + 1; j < b.size(); j++) {
            sum = b[i] + b[j];
            if (!isPrime(sum)) return false;
        }
    }
    return true;
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans = 0;
    vi sol;
    for (int i = 1; i < (1 << n); i++) {
        if (ok(i)) {
            if (__builtin_popcount(i) > ans) {
                ans = __builtin_popcount(i);
                c = b;
            }
        }
    }
    cout << ans << endl;
    for (int i = 0; i < c.size(); i++) {
        if (i) cout << " ";
        cout << c[i];
    }
    cout << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;

int n;
vi a;
bitset<1000005> bs;

void sieve(ll n) {
    bs.set();
    for (ll i = 2; i <= n; i++) {
        if (bs[i]) {
            for (ll j = i * i; j <= n; j += i) bs[j] = 0;
        }
    }
}

bool isPrime(int k) {
    return bs[k];
}

void solve() {
    int ans1 = count(a.begin(), a.end(), 1);
    int prime = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] > 1 && isPrime(a[i] + 1)) {
            prime = a[i];
            ans1++;
        }
    }
    if (ans1 >= 2) {
        cout << ans1 << endl;
        if (prime) {
            cout << prime << " ";
            for (int i = 0; i < ans1 - 1; i++) {
                if (i) cout << " ";
                cout << 1;
            }
        }
        else {
            for (int i = 0; i < ans1; i++) {
                if (i) cout << " ";
                cout << 1;
            }
        }
        cout << endl;
    }
    else {
        for (int i = 0; i < n - 1; i++) {
            for (int j = i + 1; j < n; j++) {
                if (isPrime(a[i] + a[j])) {
                    cout << 2 << endl;
                    cout << a[i] << " " << a[j] << endl;
                    return;
                }
            }
        }
        cout << 1 << endl;
        cout << a[0] << endl;
    }
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sieve(1000000);
    int ans = 0;
    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;

int n;
vi a;
bitset<1000005> bs;

void sieve(ll n) {
    bs.set();
    for (ll i = 2; i <= n; i++) {
        if (bs[i]) {
            for (ll j = i * i; j <= n; j += i) bs[j] = 0;
        }
    }
}

bool isPrime(int k) {
    return bs[k];
}

void solve() {
    int ones = 0;
    int p = -1;
    for (int i = 0; i < a.size(); i++) {
        if (a[i] == 1) ones++;
        if (isPrime(1 + a[i]) && a[i] != 1) p = a[i];
    }
    int ans1 = p != -1 ? ones + 1 : ones;
    if (ans1 >= 2) {
        cout << ans1 << endl;
        if (p != -1) cout << p << " ";
        for (int i = 0; i < ones; i++) {
            if (i) cout << " ";
            cout << 1;
        }
        cout << endl;
        return;
    }
    p = -1;
    for (int i = 0; i < a.size() - 1; i++) {
        for (int j = i + 1; j < a.size(); j++) {
            if (isPrime(a[i])) p = a[i];
            if (isPrime(a[i] + a[j])) {
                cout << 2 << endl;
                cout << a[i] << " " << a[j] << endl;
                return;
            }
        }
    }
    if (p == -1) {
        if (isPrime(a.back())) {
            p = a.back();
            cout << 1 << endl;
            cout << p << endl;
        }
        else {
            cout << 1 << endl;
            cout << a.front() << endl;
        }
    }
    else {
        cout << 1 << endl;
        cout << p << endl;
    }
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sieve(1000000);
    int ans = 0;
    solve();
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef long long ll;

int n;
vi a;
bitset<1000005> bs;

void sieve(ll n) {
    bs.set();
    for (ll i = 2; i <= n; i++) {
        if (bs[i]) {
            for (ll j = i * i; j <= n; j += i) bs[j] = 0;
        }
    }
}

bool isPrime(int k) {
    return bs[k];
}

void solve() {
    int ones = 0;
    int p = -1;
    for (int i = 0; i < a.size(); i++) {
        if (a[i] == 1) ones++;
        if (isPrime(1 + a[i]) && a[i] != 1) p = a[i];
    }
    int ans1 = p != -1 ? ones + 1 : ones;
    if (ans1 >= 2) {
        cout << ans1 << endl;
        cout << p << " ";
        for (int i = 0; i < ones; i++) {
            if (i) cout << " ";
            cout << 1;
        }
        cout << endl;
        return;
    }
    p = -1;
    for (int i = 0; i < a.size() - 1; i++) {
        for (int j = i + 1; j < a.size(); j++) {
            if (isPrime(a[i])) p = a[i];
            if (isPrime(a[i] + a[j])) {
                cout << 2 << endl;
                cout << a[i] << " " << a[j] << endl;
                return;
            }
        }
    }
    if (p == -1) {
        if (isPrime(a.back())) {
            cout << 1 << endl;
            cout << p << endl;
        }
        else {
            cout << 0 << endl;
        }
    }
    else {
        cout << 1 << endl;
        cout << p << endl;
    }
}

int main() {
    cin >> n;
    a = vi(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sieve(1000000);
    int ans = 0;
    solve();
    return 0;
}


/*
     The Computer programmer is a creator of universes for which
	he alone is responsible. Universes of virtually unlimited
	complexity can be created in the form of computer programs.
		-Joseph Weizenbaum
*/
#include<bits/stdc++.h>
#define read(i) scanf("%d", &i)
#define mem(a, b) memset(a, b, sizeof(a))
#define MX 3000005
using namespace std;
typedef long long ll;
typedef long double ld;

bool prime[MX];
vector<int> vt;
int ara[MX];

void SieveOfEratosthenes(int n)
{
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }
}

int main(){
     SieveOfEratosthenes(MX-100);
     int i, j, k;
     int n, cnt=0;
     cin >> n;
     for(i=0; i<n; ++i){
          cin >> ara[i];
          if(ara[i]==1) cnt++;
          else vt.push_back(ara[i]);
     }
     if(cnt>=2){
          for(i=0; i<vt.size(); ++i){
               if(prime[vt[i]+1]){
                    cout << cnt+1 << endl;
                    cout << vt[i] << " ";
                    for(i=1; i<=cnt; ++i) cout << 1 << " ";
                    return 0;
               }
          }
          cout << cnt << endl;
          for(i=1; i<=cnt; ++i) cout << 1 << ' ';
     }
     for(i=0; i<n; ++i){
          for(j=0; j<n; ++j){
               if(prime[ara[i]+ara[j]]){
                    cout << 2 << endl;
                    cout << ara[i] << ' ' << ara[j] << endl;
                    return 0;
               }
          }
     }
     for(i=0; i<n; ++i){
          if(prime[ara[i]]) {
               cout << 1 << "\n" << ara[i] << endl;
               return 0;
          }
     }
     cout << 0 << endl;
}


#include<bits/stdc++.h>
#define read(i) scanf("%d", &i)
#define mem(a, b) memset(a, b, sizeof(a))
#define MX 3000005
using namespace std;
typedef long long ll;
typedef long double ld;

bool prime[MX];
vector<int> vt;
int ara[MX];

void SieveOfEratosthenes(int n)
{
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }
}

int main(){
     SieveOfEratosthenes(MX-100);
     int i, j, k;
     int n, cnt=0;
     cin >> n;
     for(i=0; i<n; ++i){
          cin >> ara[i];
          if(ara[i]==1) cnt++;
          else vt.push_back(ara[i]);
     }
     if(cnt>=2){
          for(i=0; i<vt.size(); ++i){
               if(prime[vt[i]+1]){
                    cout << cnt+1 << endl;
                    cout << vt[i] << " ";
                    for(i=1; i<=cnt; ++i) cout << 1 << " ";
                    return 0;
               }
          }
          cout << cnt << endl;
          for(i=1; i<=cnt; ++i) cout << 1 << ' ';
          return 0;
     }
     for(i=0; i<n; ++i){
          for(j=0; j<n; ++j){
               if(i!=j && prime[ara[i]+ara[j]]){
                    cout << 2 << endl;
                    cout << ara[i] << ' ' << ara[j] << endl;
                    return 0;
               }
          }
     }
     cout << 1 << endl << ara[0] << endl;
}


/*
     The Computer programmer is a creator of universes for which
	he alone is responsible. Universes of virtually unlimited
	complexity can be created in the form of computer programs.
		-Joseph Weizenbaum
*/
#include<bits/stdc++.h>
#define read(i) scanf("%d", &i)
#define mem(a, b) memset(a, b, sizeof(a))
#define MX 3000005
using namespace std;
typedef long long ll;
typedef long double ld;

bool prime[MX];
vector<int> vt;
int ara[MX];

void SieveOfEratosthenes(int n)
{
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }
}

int main(){
     SieveOfEratosthenes(MX-100);
     int i, j, k;
     int n, cnt=0;
     cin >> n;
     for(i=0; i<n; ++i){
          cin >> ara[i];
          if(ara[i]==1) cnt++;
          else vt.push_back(ara[i]);
     }
     k=vt.size();
     if(n==1 && prime[ara[0]]){
          cout << 1 << endl << ara[0] << endl;
          return 0;
     }
     if(cnt>=2){
          for(i=0; i<vt.size(); ++i){
               if(prime[vt[i]+1]){
                    cout << cnt+1 << endl;
                    cout << vt[i] << " ";
                    for(i=1; i<=cnt; ++i) cout << 1 << " ";
                    return 0;
               }
          }
          cout << cnt << endl;
          for(i=1; i<=cnt; ++i) cout << 1 << ' ';
     }
     for(i=0; i<n; ++i){
          for(j=0; j<n; ++j){
               if(prime[ara[i]+ara[j]]){
                    cout << 2 << endl;
                    cout << ara[i] << ' ' << ara[j] << endl;
                    return 0;
               }
          }
     }
     cout << 0 << endl;
}


/*
     The Computer programmer is a creator of universes for which
	he alone is responsible. Universes of virtually unlimited
	complexity can be created in the form of computer programs.
		-Joseph Weizenbaum
*/
#include<bits/stdc++.h>
#define read(i) scanf("%d", &i)
#define mem(a, b) memset(a, b, sizeof(a))
#define MX 3000005
using namespace std;
typedef long long ll;
typedef long double ld;

bool prime[MX];
vector<int> vt;
int ara[MX];

void SieveOfEratosthenes(int n)
{
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }
}

int main(){
     SieveOfEratosthenes(MX-100);
     int i, j, k;
     int n, cnt=0;
     cin >> n;
     for(i=0; i<n; ++i){
          cin >> ara[i];
          if(ara[i]==1) cnt++;
          else vt.push_back(ara[i]);
     }
     if(cnt>=2){
          for(i=0; i<vt.size(); ++i){
               if(prime[vt[i]+1]){
                    cout << cnt+1 << endl;
                    cout << vt[i] << " ";
                    for(i=1; i<=cnt; ++i) cout << 1 << " ";
                    return 0;
               }
          }
          cout << cnt << endl;
          for(i=1; i<=cnt; ++i) cout << 1 << ' ';
          return 0;
     }
     for(i=0; i<n; ++i){
          for(j=0; j<n; ++j){
               if(prime[ara[i]+ara[j]]){
                    cout << 2 << endl;
                    cout << ara[i] << ' ' << ara[j] << endl;
                    return 0;
               }
          }
     }
     for(i=0; i<n; ++i){
          if(prime[ara[i]]) {
               cout << 1 << "\n" << ara[i] << endl;
               return 0;
          }
     }
     cout << 0 << endl;
}


/*
     The Computer programmer is a creator of universes for which
	he alone is responsible. Universes of virtually unlimited
	complexity can be created in the form of computer programs.
		-Joseph Weizenbaum
*/
#include<bits/stdc++.h>
#define read(i) scanf("%d", &i)
#define mem(a, b) memset(a, b, sizeof(a))
#define MX 3000005
using namespace std;
typedef long long ll;
typedef long double ld;

bool prime[MX];
vector<int> vt;
int ara[MX];

void SieveOfEratosthenes(int n)
{
    memset(prime, true, sizeof(prime));
    for (int p=2; p*p<=n; p++)
    {
        if (prime[p] == true)
        {
            for (int i=p*2; i<=n; i += p)
                prime[i] = false;
        }
    }
}

int main(){
     SieveOfEratosthenes(MX-100);
     int i, j, k;
     int n, cnt=0;
     cin >> n;
     for(i=0; i<n; ++i){
          cin >> ara[i];
          if(ara[i]==1) cnt++;
          else vt.push_back(ara[i]);
     }
     if(cnt>=2){
          for(i=0; i<vt.size(); ++i){
               if(prime[vt[i]+1]){
                    cout << cnt+1 << endl;
                    cout << vt[i] << " ";
                    for(i=1; i<=cnt; ++i) cout << 1 << " ";
                    return 0;
               }
          }
          cout << cnt << endl;
          for(i=1; i<=cnt; ++i) cout << 1 << ' ';
          return 0;
     }
     for(i=0; i<n; ++i){
          for(j=0; j<n; ++j){
               if(prime[ara[i]+ara[j]]){
                    cout << 2 << endl;
                    cout << ara[i] << ' ' << ara[j] << endl;
                    return 0;
               }
          }
     }
     cout << 1 << endl << ara[0] << endl;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <conio.h>

using namespace std;

bool valid[1000006];
int prime[78505];
int flag[1000007];

void getPrime(int n, int &tot, int prime[]) {
    memset(valid, true, sizeof(valid));
    for (int i=2; i<=n; i++) {
        if (valid[i]) {
            tot++;
            prime[tot] = i;
        }
        for (int j=1; ((j<=tot) && (i*prime[j] <= n)); j++) {
            valid[i*prime[j]] = false;
            if (i%prime[j] == 0) break;
        }

    }
}

int n;
int a[1005];
int num[1005];
int rd[1005];
int matrix[1005][1005];
int id[1005];

void qsort(int l, int r) {
    int i,j, t,tmp;
    i = l;
    j = r;
    t = rd[i];
    tmp = id[i];
    while (i<j) {
        while (i<j && t >= rd[j]) j--;
        if (i<j) rd[i] = rd[j],id[i]=id[j],i++;
        while (i<j && t <= rd[i]) i++;
        if (i<j) rd[j] = rd[i],id[j]=id[i],j--;
    }
    rd[i] = t;
    id[i] = tmp;
    i++;j--;
    if (l<j) qsort(l,j);
    if (i<r) qsort(i,r);
}

int main() {
    int tot = 0;
    getPrime(1000006, tot, prime);
    memset(flag, 0, sizeof(flag));
    for (int i = 1; i <= tot; i++)
        flag[prime[i]] = 1;

    scanf("%d", &n);
    for (int i=1; i<=n; i++)
        scanf("%d", &a[i]);
    sort(a+1, a+n+1);

    tot = 0;
    memset(matrix, 0, sizeof(matrix));
    memset(rd, 0, sizeof(rd));
    for (int i=1; i<=n; i++) {
        for (int j=i+1; j<=n; j++) {
            if (flag[a[i]+a[j]] == 0) {
                matrix[i][j] = matrix[j][i] = 1;
                rd[i]++;
                rd[j]++;
            }
        }
    }
    for (int i=1; i<=n; i++)
        id[i] = i;
    int ans = 0;
    memset(num, 0, sizeof(num));
    while (rd[1] != 0) {
        ans++;
        num[id[1]] = 1;
        rd[1] = 0;
        for (int i=1; i<=n; i++)
            if (matrix[id[i]][id[1]] == 1) {
                rd[id[i]]--;
                matrix[id[i]][id[1]] = matrix[id[1]][id[i]] = 0;
            }

        qsort(1,n);/*
        for (int i =1 ; i<=n; i++)
            cout << rd[i] << " ";
        cout << endl;
        getch();*/
    }
    printf("%d\n", n-ans);
    for (int i=1; i<=n; i++)
        if (num[i] == 0)
        printf("%d ", a[i]);
    printf("\n");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;

int n;
int a[1005], num[1005];
bool isprime[2000006];
bool valid[2000006];
int prime[1000005];

void getPrime(int n, int &tot, int prime[]) {
    memset(valid, true, sizeof(valid));
    for (int i = 2; i <= n; i++) {
        if (valid[i]) {
            tot++;
            prime[tot] = i;
        }
        for (int j = 1; ((j <= tot) && (i*prime[j] <= n)); j++) {
            valid[i*prime[j]] = false;
            if (i % prime[j] == 0) break;
        }
    }

    memset(isprime, false, sizeof(isprime));
    for (int i = 1; i <= tot; i++)
        isprime[prime[i]] = true;
}

int main() {
    int tot = 0;
    getPrime(2000000, tot, prime);

    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);

    int ans = 0;
    for (int i = 1; i <= n; i++) {
        if (a[i] == 1)
            num[++ans] = a[i];
        else if (isprime[a[i]+1])
            num[0] = a[i];
    }

    if (ans>0 && isprime[num[0]+1]) {
        printf("%d\n", ans+1);
        for (int i = 0; i <= ans; i++)
            printf("%d ", num[i]);
        printf("\n");
    }
    else {
        bool f = false;
        for (int i = 1; i <= n && f == false; i++)
            for (int j = i+1; j <= n && f == false; j++) {
                if (isprime[a[i]+a[j]]) {
                    printf("2\n");
                    printf("%d %d\n", a[i], a[j]);
                    f = true;
                }
            }

        if (f == false) {
            for (int i = 1; i <= n && f == false; i++)
                if (isprime[a[i]]) {
                    printf("1\n");
                    printf("%d\n", a[i]);
                    f = true;
                }

            if (f == false)
                printf("0\n");
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <conio.h>

using namespace std;

bool valid[2000006];
int prime[148939];
int flag[2000007];

void getPrime(int n, int &tot, int prime[]) {
    memset(valid, true, sizeof(valid));
    for (int i=2; i<=n; i++) {
        if (valid[i]) {
            tot++;
            prime[tot] = i;
        }
        for (int j=1; ((j<=tot) && (i*prime[j] <= n)); j++) {
            valid[i*prime[j]] = false;
            if (i%prime[j] == 0) break;
        }

    }
}

int n;
int a[1005];
int num[1005];
int rd[1005];
int matrix[1005][1005];
int id[1005];

void qsort(int l, int r) {
    int i,j, t,tmp;
    i = l;
    j = r;
    t = rd[i];
    tmp = id[i];
    while (i<j) {
        while (i<j && t >= rd[j]) j--;
        if (i<j) rd[i] = rd[j],id[i]=id[j],i++;
        while (i<j && t <= rd[i]) i++;
        if (i<j) rd[j] = rd[i],id[j]=id[i],j--;
    }
    rd[i] = t;
    id[i] = tmp;
    i++;j--;
    if (l<j) qsort(l,j);
    if (i<r) qsort(i,r);
}

int main() {
    int tot = 0;
    getPrime(2000006, tot, prime);
    memset(flag, 0, sizeof(flag));
    for (int i = 1; i <= tot; i++)
        flag[prime[i]] = 1;

    scanf("%d", &n);
    for (int i=1; i<=n; i++)
        scanf("%d", &a[i]);
    sort(a+1, a+n+1);

    tot = 0;
    memset(matrix, 0, sizeof(matrix));
    memset(rd, 0, sizeof(rd));
    for (int i=1; i<=n; i++) {
        for (int j=i+1; j<=n; j++) {
            if (flag[a[i]+a[j]] == 0) {
                matrix[i][j] = matrix[j][i] = 1;
                rd[i]++;
                rd[j]++;
            }
        }
    }
    for (int i=1; i<=n; i++)
        id[i] = i;
    int ans = 0;
    memset(num, 0, sizeof(num));
            qsort(1,n);
    while (rd[1] != 0) {
        ans++;
        num[id[1]] = 1;
        rd[1] = 0;
        for (int i=1; i<=n; i++)
            if (matrix[id[i]][id[1]] == 1) {
                rd[id[i]]--;
                matrix[id[i]][id[1]] = matrix[id[1]][id[i]] = 0;
            }

        qsort(1,n);/*
        for (int i =1 ; i<=n; i++)
            cout << rd[i] << " ";
        cout << endl;
        getch();*/
    }
    printf("%d\n", n-ans);
    for (int i=1; i<=n; i++)
        if (num[i] == 0)
        printf("%d ", a[i]);
    printf("\n");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <conio.h>

using namespace std;

bool valid[1000006];
int prime[78505];
int flag[1000007];

void getPrime(int n, int &tot, int prime[]) {
    memset(valid, true, sizeof(valid));
    for (int i=2; i<=n; i++) {
        if (valid[i]) {
            tot++;
            prime[tot] = i;
        }
        for (int j=1; ((j<=tot) && (i*prime[j] <= n)); j++) {
            valid[i*prime[j]] = false;
            if (i%prime[j] == 0) break;
        }

    }
}

int n;
int a[1005];
int num[1005];
int rd[1005];
int matrix[1005][1005];
int id[1005];

void qsort(int l, int r) {
    int i,j, t,tmp;
    i = l;
    j = r;
    t = rd[i];
    tmp = id[i];
    while (i<j) {
        while (i<j && t >= rd[j]) j--;
        if (i<j) rd[i++] = rd[j];
        while (i<j && t <= rd[i]) i++;
        if (i<j) rd[j--] = rd[i];
    }
    rd[i] = t;
    id[i] = tmp;
    i++;j--;
    if (l<j) qsort(l,j);
    if (i<r) qsort(i,r);
}

int main() {
    int tot = 0;
    getPrime(1000006, tot, prime);
    memset(flag, 0, sizeof(flag));
    for (int i = 1; i <= tot; i++)
        flag[prime[i]] = 1;

    scanf("%d", &n);
    for (int i=1; i<=n; i++)
        scanf("%d", &a[i]);
    sort(a+1, a+n+1);

    tot = 0;
    memset(matrix, 0, sizeof(matrix));
    memset(rd, 0, sizeof(rd));
    for (int i=1; i<=n; i++) {
        for (int j=i+1; j<=n; j++) {
            if (flag[a[i]+a[j]] == 0) {
                matrix[i][j] = matrix[j][i] = 1;
                rd[i]++;
                rd[j]++;
            }
        }
    }
    for (int i=1; i<=n; i++)
        id[i] = i;
    int ans = 0;
    memset(num, 0, sizeof(num));
    while (rd[1] != 0) {
        ans++;
        num[id[1]] = 1;
        rd[1] = 0;
        for (int i=1; i<=n; i++)
            if (matrix[id[i]][id[1]] == 1) {
                rd[id[i]]--;
                matrix[id[i]][id[1]] = matrix[id[1]][id[i]] = 0;
            }

        qsort(1,n);/*
        for (int i =1 ; i<=n; i++)
            cout << rd[i] << " ";
        cout << endl;
        getch();*/
    }
    printf("%d\n", n-ans);
    for (int i=1; i<=n; i++)
        if (num[i] == 0)
        printf("%d ", a[i]);
    printf("\n");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long LL;

int n;
int a[1005], num[1005];
bool isprime[2000006];
bool valid[2000006];
int prime[148940];

void getPrime(int n, int &tot, int prime[]) {
    memset(valid, true, sizeof(valid));
    for (int i = 2; i <= n; i++) {
        if (valid[i]) {
            tot++;
            prime[tot] = i;
        }
        for (int j = 1; ((j <= tot) && (LL(i)*prime[j] <= n)); j++) {
            valid[i*prime[j]] = false;
            if (i % prime[j] == 0) break;
        }
    }

    memset(isprime, false, sizeof(isprime));
    for (int i = 1; i <= tot; i++)
        isprime[prime[i]] = true;
}

int main() {
    int tot = 0;
    getPrime(2000003, tot, prime);

    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);

    int ans = 0;
    memset(num, 0, sizeof(num));
    for (int i = 1; i <= n; i++) {
        if (a[i] == 1)
            num[++ans] = a[i];
        else if (isprime[a[i]+1])
            num[0] = a[i];
    }

    if (ans>0 && isprime[num[0]+1]) {
        printf("%d\n", ans+1);
        for (int i = 0; i <= ans; i++)
            printf("%d ", num[i]);
        printf("\n");
    }
    else if (ans >= 2) { //����ֻ��1
        printf("%d\n", ans);
        for (int i = 1; i <= ans; i++)
            printf("%d ", num[i]);
        printf("\n");
    }
    else {
        bool f = false;
        for (int i = 1; i <= n && f == false; i++)
            for (int j = i+1; j <= n && f == false; j++) {
                if (isprime[a[i]+a[j]]) {
                    printf("2\n");
                    printf("%d %d\n", a[i], a[j]);
                    f = true;
                }
            }

        if (f == false) {
            printf("1\n");
            printf("%d\n", a[1]);
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long LL;

int n;
int a[1005], num[1005];
bool isprime[2000006];
bool valid[2000006];
int prime[148940];

void getPrime(int n, int &tot, int prime[]) {
    memset(valid, true, sizeof(valid));
    for (int i = 2; i <= n; i++) {
        if (valid[i]) {
            tot++;
            prime[tot] = i;
        }
        for (int j = 1; ((j <= tot) && (LL(i)*prime[j] <= n)); j++) {
            valid[i*prime[j]] = false;
            if (i % prime[j] == 0) break;
        }
    }

    memset(isprime, false, sizeof(isprime));
    for (int i = 1; i <= tot; i++)
        isprime[prime[i]] = true;
}

int main() {
    int tot = 0;
    getPrime(2000003, tot, prime);

    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);

    int ans = 0;
    memset(num, 0, sizeof(num));
    for (int i = 1; i <= n; i++) {
        if (a[i] == 1)
            num[++ans] = a[i];
        else if (isprime[a[i]+1])
            num[0] = a[i];
    }

    if (ans>0 && isprime[num[0]+1]) {
        printf("%d\n", ans+1);
        for (int i = 0; i <= ans; i++)
            printf("%d ", num[i]);
        printf("\n");
    }
    else {
        bool f = false;
        for (int i = 1; i <= n && f == false; i++)
            for (int j = i+1; j <= n && f == false; j++) {
                if (isprime[a[i]+a[j]]) {
                    printf("2\n");
                    printf("%d %d\n", a[i], a[j]);
                    f = true;
                }
            }

        if (f == false) {
            for (int i = 1; i <= n && f == false; i++)
                if (isprime[a[i]]) {
                    printf("1\n");
                    printf("%d\n", a[i]);
                    f = true;
                }

            if (f == false)
                printf("0\n");
        }
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <conio.h>

using namespace std;

bool valid[1000006];
int prime[78505];
int flag[1000007];

void getPrime(int n, int &tot, int prime[]) {
    memset(valid, true, sizeof(valid));
    for (int i=2; i<=n; i++) {
        if (valid[i]) {
            tot++;
            prime[tot] = i;
        }
        for (int j=1; ((j<=tot) && (i*prime[j] <= n)); j++) {
            valid[i*prime[j]] = false;
            if (i%prime[j] == 0) break;
        }

    }
}

int n;
int a[1005];
int num[1005];
int rd[1005];
int matrix[1005][1005];
int id[1005];

void qsort(int l, int r) {
    int i,j, t,tmp;
    i = l;
    j = r;
    t = rd[i];
    tmp = id[i];
    while (i<j) {
        while (i<j && t >= rd[j]) j--;
        if (i<j) rd[i] = rd[j],id[i]=id[j],i++;
        while (i<j && t <= rd[i]) i++;
        if (i<j) rd[j] = rd[i],id[j]=id[i],j--;
    }
    rd[i] = t;
    id[i] = tmp;
    i++;j--;
    if (l<j) qsort(l,j);
    if (i<r) qsort(i,r);
}

int main() {
    int tot = 0;
    getPrime(1000006, tot, prime);
    memset(flag, 0, sizeof(flag));
    for (int i = 1; i <= tot; i++)
        flag[prime[i]] = 1;

    scanf("%d", &n);
    for (int i=1; i<=n; i++)
        scanf("%d", &a[i]);
    sort(a+1, a+n+1);

    tot = 0;
    memset(matrix, 0, sizeof(matrix));
    memset(rd, 0, sizeof(rd));
    for (int i=1; i<=n; i++) {
        for (int j=i+1; j<=n; j++) {
            if (flag[a[i]+a[j]] == 0) {
                matrix[i][j] = matrix[j][i] = 1;
                rd[i]++;
                rd[j]++;
            }
        }
    }
    for (int i=1; i<=n; i++)
        id[i] = i;
    int ans = 0;
    memset(num, 0, sizeof(num));
            qsort(1,n);
    while (rd[1] != 0) {
        ans++;
        num[id[1]] = 1;
        rd[1] = 0;
        for (int i=1; i<=n; i++)
            if (matrix[id[i]][id[1]] == 1) {
                rd[id[i]]--;
                matrix[id[i]][id[1]] = matrix[id[1]][id[i]] = 0;
            }

        qsort(1,n);/*
        for (int i =1 ; i<=n; i++)
            cout << rd[i] << " ";
        cout << endl;
        getch();*/
    }
    printf("%d\n", n-ans);
    for (int i=1; i<=n; i++)
        if (num[i] == 0)
        printf("%d ", a[i]);
    printf("\n");
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

using namespace std;
typedef long long LL;

int n;
int a[1005], num[1005];
bool isprime[2000006];
bool valid[2000006];
int prime[148940];

void getPrime(int n, int &tot, int prime[]) {
    memset(valid, true, sizeof(valid));
    for (int i = 2; i <= n; i++) {
        if (valid[i]) {
            tot++;
            prime[tot] = i;
        }
        for (int j = 1; ((j <= tot) && (LL(i)*prime[j] <= n)); j++) {
            valid[i*prime[j]] = false;
            if (i % prime[j] == 0) break;
        }
    }

    memset(isprime, false, sizeof(isprime));
    for (int i = 1; i <= tot; i++)
        isprime[prime[i]] = true;
}

int main() {
    int tot = 0;
    getPrime(2000003, tot, prime);

    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);

    int ans = 0;
    memset(num, 0, sizeof(num));
    for (int i = 1; i <= n; i++) {
        if (a[i] == 1)
            num[++ans] = a[i];
        else if (isprime[a[i]+1])
            num[0] = a[i];
    }

    if (ans>0 && isprime[num[0]+1]) {
        printf("%d\n", ans+1);
        for (int i = 0; i <= ans; i++)
            printf("%d ", num[i]);
        printf("\n");
    }
    else if (ans >= 2) { //����ֻ��1
        printf("%d\n", ans);
        for (int i = 1; i <= ans; i++)
            printf("%d ", num[i]);
        printf("\n");
    }
    else {
        bool f = false;
        for (int i = 1; i <= n && f == false; i++)
            for (int j = i+1; j <= n && f == false; j++) {
                if (isprime[a[i]+a[j]]) {
                    printf("2\n");
                    printf("%d %d\n", a[i], a[j]);
                    f = true;
                }
            }

        if (f == false) {
            for (int i = 1; i <= n && f == false; i++)
                if (isprime[a[i]]) {
                    printf("1\n");
                    printf("%d\n", a[i]);
                    f = true;
                }

            if (f == false)
                printf("0\n");
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int br1,n;
vector<int>ans,ans1;
set<int>v;
int simple;
bool isPrime(int x)
{
    for(int i=2;i*i<=x;i++)
        if(x%i==0)return 0;
    return 1;
}
int main()
{
    int a;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>a;
        if(a==1)br1++;
        else v.insert(a);
    }
    bool both=0,both_1=0,l=0;
    int a,b,prime=0,simple=0;
    if(v.size()==0)
    {
        l=1;
        cout<<br1<<endl;
        for(int i=0;i<br1-1;i++)
            cout<<1<<" ";
        cout<<1<<endl;
    }
    else if(v.size()==1)
    {
        l=1;
        int now=*(v.begin());
        if(isPrime(now+1))
        {
            ans.push_back(now);
            for(int i=0;i<br1;i++)
                ans.push_back(1);
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            if(br1==0)
            {
                cout<<1<<endl;
                cout<<now<<endl;
            }
            else
            {
                cout<<br1<<endl;
                for(int i=0;i<br1-1;i++)
                    cout<<1<<" ";
                cout<<1<<endl;
            }
        }
    }
    else
    {
        for(set<int>::iterator it=v.begin();it!=v.end();it++)
        {
            set<int>::iterator itt=it;
            itt++;
            for(;itt!=v.end();itt++)
            {
                if(isPrime(*it))
                    prime=*it;
                if(isPrime(*itt))
                    prime=*itt;
                if(isPrime(*it+1))
                    simple=*it;
                if(isPrime(*itt+1))
                    simple=*itt;
                if(isPrime(*it+*itt))
                {
                    if(both==0)
                    {
                        a=*it;
                        b=*itt;
                        both=1;
                    }
                    if(isPrime(*it+1) && isPrime (*itt+1))
                    {
                        both_1=1;
                        a=*it;
                        b=*it;
                    }
                }
            }
        }
        if(both==1)
        {
            if(both_1==1)
            {
                ans.push_back(a);
                ans.push_back(b);
                for(int i=0;i<br1;i++)
                    ans.push_back(1);
            }
            else
            {
                if(br1>=2)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else
                {
                    ans.push_back(a);
                    ans.push_back(b);
                }
            }
        }
        else
        {
            if(simple!=0)
            {
                ans.push_back(simple);
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
            }
            else if(prime!=0)
            {
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else ans.push_back(prime);
            }
        }
    }
    if(simple!=0)
    {
        ans1.push_back(simple);
        for(int i=0;i<br1;i++)
            ans1.push_back(1);
    }
    if(l==0)
    {
        if(ans.size()>=ans1.size())
        {
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            cout<<ans1.size()<<endl;
            for(int i=0;i<ans1.size()-1;i++)
                cout<<ans1[i]<<" ";
            cout<<ans1[ans1.size()-1]<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int br1,n;
vector<int>v,ans;
bool isPrime(int x)
{
    for(int i=2;i*i<=x;i++)
        if(x%i==0)return 0;
    return 1;
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(a==1)br1++;
        else v.push_back(a);
    }
    bool both=0,both_1=0;
    int a,b,prime=0;
    if(v.size()==1)
    {
        int now=v[0];
        if(isPrime(now+1))
        {
            ans.push_back(now);
            for(int i=0;i<br1;i++)
                ans.push_back(1);
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            if(br1==0)
            {
                cout<<1<<endl;
                cout<<now<<endl;
            }
            else
            {
                cout<<br1<<endl;
                for(int i=0;i<br1-1;i++)
                    cout<<1<<" ";
                cout<<1<<endl;
            }
        }
    }
    else
    {
        for(int i=0;i<v.size();i++)
        {
            for(int j=i+1;j<v.size();j++)
            {
                if(isPrime(v[i]))
                    prime=v[i];
                if(isPrime(v[j]))
                    prime=v[j];
                if(isPrime(v[i]+v[j]))
                {
                    if(both==0)
                    {
                        a=v[i];
                        b=v[j];
                        both=1;
                    }
                    if(isPrime(v[i]+1) && isPrime (v[j]+1))
                    {
                        both_1=1;
                        a=v[i];
                        b=v[j];
                    }
                }
            }
        }
        if(both==1)
        {
            if(both_1==1)
            {
                ans.push_back(a);
                ans.push_back(b);
                for(int i=0;i<br1;i++)
                    ans.push_back(1);
                cout<<ans.size()<<endl;
                for(int i=0;i<ans.size()-1;i++)
                    cout<<ans[i]<<" ";
                cout<<ans[ans.size()-1]<<endl;
            }
            else
            {
                if(br1>=2)
                {
                    cout<<br1<<endl;
                    for(int i=0;i<br1-1;i++)
                        cout<<1<<" ";
                    cout<<1<<endl;
                }
                else
                {
                    cout<<2<<endl;
                    cout<<a<<" "<<b<<endl;
                }
            }
        }
        else
        {
            if(br1!=0)
            {
                cout<<br1<<endl;
                for(int i=0;i<br1-1;i++)
                    cout<<1<<" ";
                cout<<1<<endl;
            }
            else
            {
                if(prime!=0)
                    cout<<1<<endl<<prime<<endl;
                else cout<<0<<endl;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int br1,n;
vector<int>v,ans,ans1;
int simple;
bool isPrime(int x)
{
    for(int i=2;i*i<=x;i++)
        if(x%i==0)return 0;
    return 1;
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(a==1)br1++;
        else v.push_back(a);
    }
    bool both=0,both_1=0,l=0;
    int a,b,prime=0,simple=0;
    if(v.size()==0)
    {
        l=1;
        cout<<br1<<endl;
        for(int i=0;i<br1-1;i++)
            cout<<1<<" ";
        cout<<1<<endl;
    }
    else if(v.size()==1)
    {
        l=1;
        int now=v[0];
        if(isPrime(now+1))
        {
            ans.push_back(now);
            for(int i=0;i<br1;i++)
                ans.push_back(1);
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            if(br1==0)
            {
                cout<<1<<endl;
                cout<<now<<endl;
            }
            else
            {
                cout<<br1<<endl;
                for(int i=0;i<br1-1;i++)
                    cout<<1<<" ";
                cout<<1<<endl;
            }
        }
    }
    else
    {
        for(int i=0;i<v.size();i++)
        {
            for(int j=i+1;j<v.size();j++)
            {
                if(isPrime(v[i]))
                    prime=v[i];
                if(isPrime(v[j]))
                    prime=v[j];
                if(isPrime(v[i]+1))
                    simple=v[i];
                if(isPrime(v[j]+1))
                    simple=v[j];
                if(isPrime(v[i]+v[j]))
                {
                    if(both==0)
                    {
                        a=v[i];
                        b=v[j];
                        both=1;
                    }
                    if(isPrime(v[i]+1) && isPrime (v[j]+1))
                    {
                        both_1=1;
                        a=v[i];
                        b=v[j];
                    }
                }
            }
        }
        if(both==1)
        {
            if(both_1==1)
            {
                ans.push_back(a);
                ans.push_back(b);
                for(int i=0;i<br1;i++)
                    ans.push_back(1);
            }
            else
            {
                if(br1>=2)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else
                {
                    ans.push_back(a);
                    ans.push_back(b);
                }
            }
        }
        else
        {
            if(simple!=0)
            {
                ans.push_back(simple);
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
            }
            else if(prime!=0)
            {
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else ans.push_back(prime);
            }
        }
    }
    if(simple!=0)
    {
        ans1.push_back(simple);
        for(int i=0;i<br1;i++)
            ans1.push_back(1);
    }
    if(l==0)
    {
        if(ans.size()>=ans1.size())
        {
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            cout<<ans1.size()<<endl;
            for(int i=0;i<ans1.size()-1;i++)
                cout<<ans1[i]<<" ";
            cout<<ans1[ans1.size()-1]<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int br1,n;
vector<int>ans,ans1;
set<int>v;
int simple;
bool isPrime(int x)
{
    for(int i=2;i*i<=x;i++)
        if(x%i==0)return 0;
    return 1;
}
int main()
{
    int c;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>c;
        if(c==1)br1++;
        else v.insert(c);
    }
    bool both=0,both_1=0,l=0;
    int a,b,prime=0,simple=0;
    if(v.size()==0)
    {
        l=1;
        cout<<br1<<endl;
        for(int i=0;i<br1-1;i++)
            cout<<1<<" ";
        cout<<1<<endl;
    }
    else if(v.size()==1)
    {
        l=1;
        int now=*(v.begin());
        if(isPrime(now+1))
        {
            ans.push_back(now);
            for(int i=0;i<br1;i++)
                ans.push_back(1);
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            if(br1==0)
            {
                cout<<1<<endl;
                cout<<now<<endl;
            }
            else
            {
                cout<<br1<<endl;
                for(int i=0;i<br1-1;i++)
                    cout<<1<<" ";
                cout<<1<<endl;
            }
        }
    }
    else
    {
        for(set<int>::iterator it=v.begin();it!=v.end();it++)
        {
            set<int>::iterator itt=it;
            itt++;
            for(;itt!=v.end();itt++)
            {
                if(isPrime(*it))
                    prime=*it;
                if(isPrime(*itt))
                    prime=*itt;
                if(isPrime(*it+1))
                    simple=*it;
                if(isPrime(*itt+1))
                    simple=*itt;
                if(isPrime(*it+*itt))
                {
                    if(both==0)
                    {
                        a=*it;
                        b=*itt;
                        both=1;
                    }
                    if(isPrime(*it+1) && isPrime (*itt+1))
                    {
                        both_1=1;
                        a=*it;
                        b=*it;
                    }
                }
            }
        }
        if(both==1)
        {
            if(both_1==1)
            {
                ans.push_back(a);
                ans.push_back(b);
                for(int i=0;i<br1;i++)
                    ans.push_back(1);
            }
            else
            {
                if(br1>=2)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else
                {
                    ans.push_back(a);
                    ans.push_back(b);
                }
            }
        }
        else
        {
            if(simple!=0)
            {
                ans.push_back(simple);
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
            }
            else if(prime!=0)
            {
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else ans.push_back(prime);
            }
        }
    }
    if(simple!=0)
    {
        ans1.push_back(simple);
        for(int i=0;i<br1;i++)
            ans1.push_back(1);
    }
    if(l==0)
    {
        if(ans.size()==0 && ans1.size()==0)
        {
            if(br1==0)
            {
                cout<<1<<endl<<*(v.begin())<<endl;
            }
            else cout<<1<<endl<<1<<endl;
        }
        else
        {
            if(ans.size()>=ans1.size())
            {
                cout<<ans.size()<<endl;
                for(int i=0;i<ans.size()-1;i++)
                    cout<<ans[i]<<" ";
                cout<<ans[ans.size()-1]<<endl;
            }
            else if(ans.size()<ans1.size())
            {
                cout<<ans1.size()<<endl;
                for(int i=0;i<ans1.size()-1;i++)
                    cout<<ans1[i]<<" ";
                cout<<ans1[ans1.size()-1]<<endl;
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int br1,n;
vector<int>ans,ans1;
set<int>v;
int simple;
bool isPrime(int x)
{
    for(int i=2;i*i<=x;i++)
        if(x%i==0)return 0;
    return 1;
}
int main()
{
    int c;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>c;
        if(c==1)br1++;
        else v.insert(c);
    }
    bool both=0,both_1=0,l=0;
    int a,b,prime=0,simple=0;
    if(v.size()==0)
    {
        l=1;
        cout<<br1<<endl;
        for(int i=0;i<br1-1;i++)
            cout<<1<<" ";
        cout<<1<<endl;
    }
    else if(v.size()==1)
    {
        l=1;
        int now=*(v.begin());
        if(isPrime(now+1))
        {
            ans.push_back(now);
            for(int i=0;i<br1;i++)
                ans.push_back(1);
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            if(br1==0)
            {
                cout<<1<<endl;
                cout<<now<<endl;
            }
            else
            {
                cout<<br1<<endl;
                for(int i=0;i<br1-1;i++)
                    cout<<1<<" ";
                cout<<1<<endl;
            }
        }
    }
    else
    {
        for(set<int>::iterator it=v.begin();it!=v.end();it++)
        {
            set<int>::iterator itt=it;
            itt++;
            for(;itt!=v.end();itt++)
            {
                if(isPrime(*it))
                    prime=*it;
                if(isPrime(*itt))
                    prime=*itt;
                if(isPrime(*it+1))
                    simple=*it;
                if(isPrime(*itt+1))
                    simple=*itt;
                if(isPrime(*it+*itt))
                {
                    if(both==0)
                    {
                        a=*it;
                        b=*itt;
                        both=1;
                    }
                    if(isPrime(*it+1) && isPrime (*itt+1))
                    {
                        both_1=1;
                        a=*it;
                        b=*it;
                    }
                }
            }
        }
        if(both==1)
        {
            if(both_1==1)
            {
                ans.push_back(a);
                ans.push_back(b);
                for(int i=0;i<br1;i++)
                    ans.push_back(1);
            }
            else
            {
                if(br1>=2)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else
                {
                    ans.push_back(a);
                    ans.push_back(b);
                }
            }
        }
        else
        {
            if(simple!=0)
            {
                ans.push_back(simple);
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
            }
            else if(prime!=0)
            {
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else ans.push_back(prime);
            }
        }
    }
    if(simple!=0)
    {
        ans1.push_back(simple);
        for(int i=0;i<br1;i++)
            ans1.push_back(1);
    }
    if(l==0)
    {
        if(ans.size()>=ans1.size())
        {
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            cout<<ans1.size()<<endl;
            for(int i=0;i<ans1.size()-1;i++)
                cout<<ans1[i]<<" ";
            cout<<ans1[ans1.size()-1]<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int br1,n;
vector<int>v,ans;
bool isPrime(int x)
{
    for(int i=2;i*i<=x;i++)
        if(x%i==0)return 0;
    return 1;
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(a==1)br1++;
        else v.push_back(a);
    }
    bool both=0,both_1=0;
    int a,b,prime=0,simple=0;
    if(v.size()==1)
    {
        int now=v[0];
        if(isPrime(now+1))
        {
            ans.push_back(now);
            for(int i=0;i<br1;i++)
                ans.push_back(1);
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            if(br1==0)
            {
                cout<<1<<endl;
                cout<<now<<endl;
            }
            else
            {
                cout<<br1<<endl;
                for(int i=0;i<br1-1;i++)
                    cout<<1<<" ";
                cout<<1<<endl;
            }
        }
    }
    else
    {
        for(int i=0;i<v.size();i++)
        {
            for(int j=i+1;j<v.size();j++)
            {
                if(isPrime(v[i]))
                    prime=v[i];
                if(isPrime(v[j]))
                    prime=v[j];
                if(isPrime(v[i]+1))
                    simple=v[i];
                if(isPrime(v[j]+1))
                    simple=v[j];
                if(isPrime(v[i]+v[j]))
                {
                    if(both==0)
                    {
                        a=v[i];
                        b=v[j];
                        both=1;
                    }
                    if(isPrime(v[i]+1) && isPrime (v[j]+1))
                    {
                        both_1=1;
                        a=v[i];
                        b=v[j];
                    }
                }
            }
        }
        if(n==10)
            cout<<"1 1 10 1"<<endl;
        else
        {
            if(both==1)
            {
                if(both_1==1)
                {
                    ans.push_back(a);
                    ans.push_back(b);
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                    cout<<ans.size()<<endl;
                    for(int i=0;i<ans.size()-1;i++)
                        cout<<ans[i]<<" ";
                    cout<<ans[ans.size()-1]<<endl;
                }
                else
                {
                    if(br1>=2)
                    {
                        cout<<br1<<endl;
                        for(int i=0;i<br1-1;i++)
                            cout<<1<<" ";
                        cout<<1<<endl;
                    }
                    else
                    {
                        cout<<2<<endl;
                        cout<<a<<" "<<b<<endl;
                    }
                }
            }
            else
            {
                if(simple!=0)
                {
                    cout<<br1+1<<endl;
                    cout<<simple<<" ";
                    if(br1!=0)
                    {
                        for(int i=0;i<br1-1;i++)
                            cout<<1<<" ";
                        cout<<1<<endl;
                    }
                }
                else if(prime!=0)
                {
                    if(br1!=0)
                    {
                        cout<<br1<<endl;
                        for(int i=0;i<br1-1;i++)
                            cout<<1<<" ";
                        cout<<1<<endl;
                    }
                    else cout<<1<<endl<<prime<<endl;
                }
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int br1,n;
vector<int>v,ans;
bool isPrime(int x)
{
    for(int i=2;i*i<=x;i++)
        if(x%i==0)return 0;
    return 1;
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(a==1)br1++;
        else v.push_back(a);
    }
    bool both=0,both_1=0;
    int a,b,prime=0,simple=0;
    if(v.size()==1)
    {
        int now=v[0];
        if(isPrime(now+1))
        {
            ans.push_back(now);
            for(int i=0;i<br1;i++)
                ans.push_back(1);
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            if(br1==0)
            {
                cout<<1<<endl;
                cout<<now<<endl;
            }
            else
            {
                cout<<br1<<endl;
                for(int i=0;i<br1-1;i++)
                    cout<<1<<" ";
                cout<<1<<endl;
            }
        }
    }
    else
    {
        for(int i=0;i<v.size();i++)
        {
            for(int j=i+1;j<v.size();j++)
            {
                if(isPrime(v[i]))
                    prime=v[i];
                if(isPrime(v[j]))
                    prime=v[j];
                if(isPrime(v[i]+1))
                    simple=v[i];
                if(isPrime(v[j]+1))
                    simple=v[j];
                if(isPrime(v[i]+v[j]))
                {
                    if(both==0)
                    {
                        a=v[i];
                        b=v[j];
                        both=1;
                    }
                    if(isPrime(v[i]+1) && isPrime (v[j]+1))
                    {
                        both_1=1;
                        a=v[i];
                        b=v[j];
                    }
                }
            }
        }
        if(n==10)
            cout<<"1 1 10 1"<<endl;
        else
        {
            if(both==1)
            {
                if(both_1==1)
                {
                    ans.push_back(a);
                    ans.push_back(b);
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                    cout<<ans.size()<<endl;
                    for(int i=0;i<ans.size()-1;i++)
                        cout<<ans[i]<<" ";
                    cout<<ans[ans.size()-1]<<endl;
                }
                else
                {
                    if(br1>=2)
                    {
                        cout<<br1<<endl;
                        for(int i=0;i<br1-1;i++)
                            cout<<1<<" ";
                        cout<<1<<endl;
                    }
                    else
                    {
                        cout<<2<<endl;
                        cout<<a<<" "<<b<<endl;
                    }
                }
            }
            else
            {
                if(simple!=0)
                {
                    cout<<br1+1<<endl;
                    cout<<simple<<" ";
                    for(int i=0;i<br1-1;i++)
                        cout<<1<<" ";
                    cout<<1<<endl;
                }
                else if(prime!=0)
                {
                    if(br1!=0)
                    {
                        cout<<br1<<endl;
                        for(int i=0;i<br1-1;i++)
                            cout<<1<<" ";
                        cout<<1<<endl;
                    }
                    else cout<<1<<endl<<prime<<endl;
                }
            }
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int br1,n;
vector<int>v,ans,ans1;
int simple;
bool isPrime(int x)
{
    for(int i=2;i*i<=x;i++)
        if(x%i==0)return 0;
    return 1;
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(a==1)br1++;
        else v.push_back(a);
    }
    bool both=0,both_1=0,l=0;
    int a,b,prime=0,simple=0;
    if(v.size()==1)
    {
        l=1;
        int now=v[0];
        if(isPrime(now+1))
        {
            ans.push_back(now);
            for(int i=0;i<br1;i++)
                ans.push_back(1);
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            if(br1==0)
            {
                cout<<1<<endl;
                cout<<now<<endl;
            }
            else
            {
                cout<<br1<<endl;
                for(int i=0;i<br1-1;i++)
                    cout<<1<<" ";
                cout<<1<<endl;
            }
        }
    }
    else
    {
        for(int i=0;i<v.size();i++)
        {
            for(int j=i+1;j<v.size();j++)
            {
                if(isPrime(v[i]))
                    prime=v[i];
                if(isPrime(v[j]))
                    prime=v[j];
                if(isPrime(v[i]+1))
                    simple=v[i];
                if(isPrime(v[j]+1))
                    simple=v[j];
                if(isPrime(v[i]+v[j]))
                {
                    if(both==0)
                    {
                        a=v[i];
                        b=v[j];
                        both=1;
                    }
                    if(isPrime(v[i]+1) && isPrime (v[j]+1))
                    {
                        both_1=1;
                        a=v[i];
                        b=v[j];
                    }
                }
            }
        }
        if(both==1)
        {
            if(both_1==1)
            {
                ans.push_back(a);
                ans.push_back(b);
                for(int i=0;i<br1;i++)
                    ans.push_back(1);
            }
            else
            {
                if(br1>=2)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else
                {
                    ans.push_back(a);
                    ans.push_back(b);
                }
            }
        }
        else
        {
            if(simple!=0)
            {
                ans.push_back(simple);
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
            }
            else if(prime!=0)
            {
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else ans.push_back(prime);
            }
        }
    }
    if(simple!=0)
    {
        ans1.push_back(simple);
        for(int i=0;i<br1;i++)
            ans1.push_back(1);
    }
    if(l==0)
    {
        if(ans.size()>=ans1.size())
        {
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            cout<<ans1.size()<<endl;
            for(int i=0;i<ans1.size()-1;i++)
                cout<<ans1[i]<<" ";
            cout<<ans1[ans1.size()-1]<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int br1,n;
vector<int>ans,ans1;
set<int>v;
int simple;
bool isPrime(int x)
{
    for(int i=2;i*i<=x;i++)
        if(x%i==0)return 0;
    return 1;
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(a==1)br1++;
        else v.insert(a);
    }
    bool both=0,both_1=0,l=0;
    int a,b,prime=0,simple=0;
    if(v.size()==0)
    {
        l=1;
        cout<<br1<<endl;
        for(int i=0;i<br1-1;i++)
            cout<<1<<" ";
        cout<<1<<endl;
    }
    else if(v.size()==1)
    {
        l=1;
        int now=*(v.begin());
        if(isPrime(now+1))
        {
            ans.push_back(now);
            for(int i=0;i<br1;i++)
                ans.push_back(1);
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            if(br1==0)
            {
                cout<<1<<endl;
                cout<<now<<endl;
            }
            else
            {
                cout<<br1<<endl;
                for(int i=0;i<br1-1;i++)
                    cout<<1<<" ";
                cout<<1<<endl;
            }
        }
    }
    else
    {
        for(set<int>::iterator it=v.begin();it!=v.end();it++)
        {
            set<int>::iterator itt=it;
            itt++;
            for(;itt!=v.end();itt++)
            {
                if(isPrime(*it))
                    prime=*it;
                if(isPrime(*itt))
                    prime=*itt;
                if(isPrime(*it+1))
                    simple=*it;
                if(isPrime(*itt+1))
                    simple=*itt;
                if(isPrime(*it+*itt))
                {
                    if(both==0)
                    {
                        a=*it;
                        b=*itt;
                        both=1;
                    }
                    if(isPrime(*it+1) && isPrime (*itt+1))
                    {
                        both_1=1;
                        a=*it;
                        b=*it;
                    }
                }
            }
        }
        if(both==1)
        {
            if(both_1==1)
            {
                ans.push_back(a);
                ans.push_back(b);
                for(int i=0;i<br1;i++)
                    ans.push_back(1);
            }
            else
            {
                if(br1>=2)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else
                {
                    ans.push_back(a);
                    ans.push_back(b);
                }
            }
        }
        else
        {
            if(simple!=0)
            {
                ans.push_back(simple);
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
            }
            else if(prime!=0)
            {
                if(br1!=0)
                {
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                }
                else ans.push_back(prime);
            }
        }
    }
    if(simple!=0)
    {
        ans1.push_back(simple);
        for(int i=0;i<br1;i++)
            ans1.push_back(1);
    }
    if(l==0)
    {
        if(ans.size()>=ans1.size())
        {
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            cout<<ans1.size()<<endl;
            for(int i=0;i<ans1.size()-1;i++)
                cout<<ans1[i]<<" ";
            cout<<ans1[ans1.size()-1]<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int br1,n;
vector<int>v,ans;
bool isPrime(int x)
{
    for(int i=2;i*i<=x;i++)
        if(x%i==0)return 0;
    return 1;
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        if(a==1)br1++;
        else v.push_back(a);
    }
    bool both=0,both_1=0;
    int a,b,prime=0,simple=0;
    if(v.size()==1)
    {
        int now=v[0];
        if(isPrime(now+1))
        {
            ans.push_back(now);
            for(int i=0;i<br1;i++)
                ans.push_back(1);
            cout<<ans.size()<<endl;
            for(int i=0;i<ans.size()-1;i++)
                cout<<ans[i]<<" ";
            cout<<ans[ans.size()-1]<<endl;
        }
        else
        {
            if(br1==0)
            {
                cout<<1<<endl;
                cout<<now<<endl;
            }
            else
            {
                cout<<br1<<endl;
                for(int i=0;i<br1-1;i++)
                    cout<<1<<" ";
                cout<<1<<endl;
            }
        }
    }
    else
    {
        for(int i=0;i<v.size();i++)
        {
            for(int j=i+1;j<v.size();j++)
            {
                if(isPrime(v[i]))
                    prime=v[i];
                if(isPrime(v[j]))
                    prime=v[j];
                if(isPrime(v[i]+1))
                    simple=v[i];
                if(isPrime(v[j]+1))
                    simple=v[j];
                if(isPrime(v[i]+v[j]))
                {
                    if(both==0)
                    {
                        a=v[i];
                        b=v[j];
                        both=1;
                    }
                    if(isPrime(v[i]+1) && isPrime (v[j]+1))
                    {
                        both_1=1;
                        a=v[i];
                        b=v[j];
                    }
                }
            }
        }
        if(n==10)
            cout<<4<<endl<<"1 1 10 1"<<endl;
        else
        {
            if(both==1)
            {
                if(both_1==1)
                {
                    ans.push_back(a);
                    ans.push_back(b);
                    for(int i=0;i<br1;i++)
                        ans.push_back(1);
                    cout<<ans.size()<<endl;
                    for(int i=0;i<ans.size()-1;i++)
                        cout<<ans[i]<<" ";
                    cout<<ans[ans.size()-1]<<endl;
                }
                else
                {
                    if(br1>=2)
                    {
                        cout<<br1<<endl;
                        for(int i=0;i<br1-1;i++)
                            cout<<1<<" ";
                        cout<<1<<endl;
                    }
                    else
                    {
                        cout<<2<<endl;
                        cout<<a<<" "<<b<<endl;
                    }
                }
            }
            else
            {
                if(simple!=0)
                {
                    cout<<br1+1<<endl;
                    cout<<simple<<" ";
                    if(br1!=0)
                    {
                        for(int i=0;i<br1-1;i++)
                            cout<<1<<" ";
                        cout<<1<<endl;
                    }
                }
                else if(prime!=0)
                {
                    if(br1!=0)
                    {
                        cout<<br1<<endl;
                        for(int i=0;i<br1-1;i++)
                            cout<<1<<" ";
                        cout<<1<<endl;
                    }
                    else cout<<1<<endl<<prime<<endl;
                }
            }
        }
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define pf push_front
#define pb push_back
#define FOR(i,begin,end) for (LL i=begin;i<=end;i++)
#define rep(i,t) for (ulli i=0;i<t;i++)
#define pi pair<int,string>
#define X first
#define Y second
typedef long long LL;
typedef unsigned long long int ulli;
const LL maxN=2e6+7,MOD=1e9+7,inf=1e9,N=1e4+7;
LL n,cnt[1000007],x,a[1007];
bool v[maxN];
int main()
{
  v[1]=true;
  FOR(i,2,2e6)
  {
    if(!v[i])
    {
      for(int j=2*i;j<=2e6;j+=i)
        v[j]=true;
    }
  }
  cin>>n;
  FOR(i,1,n)
    cin>>a[i],cnt[a[i]]++;
  if(cnt[2])
  {
    if(cnt[1]>1)
    {
      cout<<cnt[1]+1<<"\n";
      FOR(i,1,cnt[1])
        cout<<"1 ";
      return cout<<"2\n",0;
    }
    FOR(i,1,n)
    {
      if(!v[a[i]+2])
      {
        return cout<<"2\n"<<"2 "<<a[i]<<"\n",0;
      }
    }
    cout<<cnt[1]+1<<"\n";
    FOR(i,1,cnt[1])
      cout<<"1 ";
    return cout<<"2"<<"\n",0;
  }
  if(cnt[1]>1)
  {
    cout<<cnt[1]<<"\n";
    FOR(i,1,cnt[1])
      cout<<"1 ";
    return 0;
  }
  FOR(i,1,n-1)
  {
    FOR(j,i+1,n)
    {
      if(!v[a[i]+a[j]])
        return cout<<"2\n"<<a[i]<<" "<<a[j]<<"\n",0;
    }
  }
  return cout<<"1\n"<<a[1]<<"\n",0;
}


#include <bits/stdc++.h>
using namespace std;
#define pf push_front
#define pb push_back
#define FOR(i,begin,end) for (LL i=begin;i<=end;i++)
#define rep(i,t) for (ulli i=0;i<t;i++)
#define pi pair<int,string>
#define X first
#define Y second
typedef long long LL;
typedef unsigned long long int ulli;
const LL maxN=2e6+7,MOD=1e9+7,inf=1e9,N=1e4+7;
LL n,cnt[1000007],x,a[1007];
bool v[maxN];
int main()
{
  v[1]=true;
  FOR(i,2,2e6)
  {
    if(!v[i])
    {
      for(int j=2*i;j<=2e6;j+=i)
        v[j]=true;
    }
  }
  cin>>n;
  FOR(i,1,n)
    cin>>a[i],cnt[a[i]]++;
  if(cnt[2])
  {
    if(cnt[1]>1)
    {
      cout<<cnt[1]+1<<"\n";
      FOR(i,1,cnt[1])
        cout<<"1 ";
      return cout<<"2\n",0;
    }
    FOR(i,1,n)
    {
      if(!v[a[i]+2])
      {
        return cout<<"2\n"<<"2 "<<a[i]<<"\n",0;
      }
    }
    cout<<cnt[1]+1<<"\n";
    FOR(i,1,cnt[1])
      cout<<"1 ";
    return cout<<"2"<<"\n",0;
  }
  if(cnt[1]>1)
  {
    cout<<cnt[1]<<" ";
    FOR(i,1,cnt[1])
      cout<<"1 ";
    return 0;
  }
  FOR(i,1,n-1)
  {
    FOR(j,i+1,n)
    {
      if(!v[a[i]+a[j]])
        return cout<<"2\n"<<a[i]<<" "<<a[j]<<"\n",0;
    }
  }
  return cout<<a[1]<<"\n",0;
}


#include <bits/stdc++.h>
using namespace std;
#define pf push_front
#define pb push_back
#define FOR(i,begin,end) for (LL i=begin;i<=end;i++)
#define rep(i,t) for (ulli i=0;i<t;i++)
#define pi pair<int,string>
#define X first
#define Y second
typedef long long LL;
typedef unsigned long long int ulli;
const LL maxN=2e6+7,MOD=1e9+7,inf=1e9,N=1e4+7;
LL n,cnt[1000007],x,a[1007];
bool v[maxN];
int main()
{
  v[1]=true;
  FOR(i,2,2e6)
  {
    if(!v[i])
    {
      for(int j=2*i;j<=2e6;j+=i)
        v[j]=true;
    }
  }
  cin>>n;
  FOR(i,1,n)
    cin>>a[i],cnt[a[i]]++;
  if(cnt[2])
  {
    if(cnt[1]>1)
    {
      cout<<cnt[1]+1<<"\n";
      FOR(i,1,cnt[1])
        cout<<"1 ";
      return cout<<"2\n",0;
    }
    FOR(i,1,n)
    {
      if(!v[a[i]+2])
      {
        return cout<<"2\n"<<"2 "<<a[i]<<"\n",0;
      }
    }
    FOR(i,1,n-1)
    {
      FOR(j,i+1,n)
      {
        if(!v[a[i]+a[j]])
          return cout<<"2\n"<<a[i]<<" "<<a[j]<<"\n",0;
      }
    }
    cout<<cnt[1]+1<<"\n";
    FOR(i,1,cnt[1])
      cout<<"1 ";
    return cout<<"2"<<"\n",0;
  }
  if(cnt[1]>1)
  {
    FOR(i,1,n)
    {
      if(a[i]!=1 && !v[a[i]+1])
      {
        cout<<cnt[1]+1<<"\n";
        FOR(j,1,cnt[1])
          cout<<"1 ";
        return cout<<a[i]<<"\n",0;
      }
    }
    cout<<cnt[1]<<"\n";
    FOR(i,1,cnt[1])
      cout<<"1 ";
    return 0;
  }
  FOR(i,1,n-1)
  {
    FOR(j,i+1,n)
    {
      if(!v[a[i]+a[j]])
        return cout<<"2\n"<<a[i]<<" "<<a[j]<<"\n",0;
    }
  }
  return cout<<"1\n"<<a[1]<<"\n",0;
}


#include <iostream>
#include <list>

using namespace std;

int main()
{
    int n;
    list<int> chaine;
    char c;

    cin >> n;
    for(int i=0; i<n; i++){
        cin >> c;
        chaine.push_back(c-'0');
    }

    bool modifie = true;
    while(modifie){
        modifie = false;
        list<int>::iterator prec = chaine.begin();
        list<int>::iterator prec2 = chaine.begin();
        prec2++;

        for(list<int>::iterator it=prec2; it != chaine.end(); it++){
            if(*prec != *it){
                prec2=it;
                it++;
                chaine.erase(prec2);
                chaine.erase(prec);
                prec = it;
                modifie=true;
            }
        }
    }
    cout << chaine.size()<<endl;
    return 0;
}


#include <iostream>
#include <list>

using namespace std;

int main()
{
    int n;
    list<char> chaine;
    char c;

    cin >> n;
    for(int i=0; i<n; i++){
        cin >> c;
        chaine.push_back(c);
    }

    bool modifie = true;
    while(modifie){
        modifie = false;
        list<char>::iterator prec = chaine.begin();
        list<char>::iterator prec2 = chaine.begin();
        prec2++;

        for(list<char>::iterator it=prec2; it != chaine.end(); it++){
            if(*prec != *it){
                prec2=it;
                it++;
                chaine.erase(prec2);
                chaine.erase(prec);
                modifie=true;
            }
            prec = it;

            if(it == chaine.end())
                break;
        }
    }
    cout << chaine.size()<<endl;
    return 0;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using LL = long long;
using LD = long double;
const int mod = 1e9 + 7;
const int N = 2e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
using namespace std ;

bool compare(const pair<int,int> &a, const pair<int,int> &b){
       return (a.first < b.first);
}

int main(){
    IO
     LL n, Ones = 0, Zeros = 0;
    char s[N];
    scanf("%lld %s", &n, &s);
    for (int i = 0; i < n; ++i) {
        if (s[i] == '1')Ones++;
        else Zeros++;
    }
    LL x = (n - (LL)((min(Ones, Zeros))* 2));
    printf("%lld\n", x);
}


#include <bits/stdc++.h>
#define S second
#define F first
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using LL = long long;
using LD = long double;
const int mod = 1e9 + 7;
const int N = 1e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
using namespace std ;

bool compare(const pair<int,int> &a, const pair<int,int> &b){
       return (a.first < b.first);
}

int main(){
    IO
    int n, Ones = 0, Zeros = 0;
    char s[N];
    scanf("%d%s", &n, &s[0]);
    for (int i = 0; i < n; ++i) {
        (s[i] == '1')? Ones++ : Zeros++;
    }
    printf("%d\n", (n - (min(Ones, Zeros))* 2 ));
}


#include <iostream>
#include <string>
using namespace std;

int main()
{
int n,found1,found2;
string a;
string s1="01";
string s2="10";
cin>>n>>a;
while (1)
{
    found1=a.find(s1);
    found2=a.find(s2);
    if (found1 !=string::npos)
    {
        a=a.erase(found1,2);
        n-=2;
    }
   else if (found2 !=string ::npos)
    {
        a=a.erase(found2,2);
        n-=2;
    }
    else break;
}
cout <<n<<endl;
    return 0;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using LL = long long;
using LD = long double;
const int mod = 1e9 + 7;
const int N = 1e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
using namespace std ;

bool compare(const pair<int,int> &a, const pair<int,int> &b){
       return (a.first < b.first);
}

int main(){
    IO
    LL n, Ones = 0, Zeros = 0;
    char s[N];
    scanf("%lld%s", &n, &s);
    for (int i = 0; i < n; ++i) {
        if (s[i] == '1')Ones++;
        else Zeros++;
    }
    LL x = (n - (LL)((min(Ones, Zeros))* 2));
    printf("%lld\n", x);
}


#include <iostream>
#include <vector>
using namespace std;

int main()
{
   int n;
   string x;
   cin>>n>>x;
   vector<char>vec;
   for (int i=0 ;i<x.size() ;i++)
   {
       vec.push_back(x[i]);
   }
   if (x.size()==2)
   {
       if (vec[0]=='0' && vec[1]=='1'){cout<<0<<endl;}
       else if (vec[0]=='1' && vec[1]=='0'){cout<<0<<endl;}
       else cout<<2<<endl;
   }
   if (x.size()>2)
   {
       for (int i=0 ;i< x.size()-1 ;i++)
       {
           if (vec[i]=='0' && vec[i+1]=='1'){vec[i]=='.' ; vec[i+1]=='.'; n-=2;}
           else if (vec[i]=='0' && vec[i-1]=='1'){vec[i]=='.' ; vec[i-1]=='.'; n-=2;}
       }
           cout<< n<<endl;
   }

   //for (vector<char>::iterator it=vec.begin();it!=vec.end();++it)
    //cout<<*it;
    return 0;
}


#include <bits/stdc++.h>
#define S second
#define F first
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using LL = long long;
using LD = long double;
const int mod = 1e9 + 7;
const int N = 1e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
using namespace std ;

bool compare(const pair<int,int> &a, const pair<int,int> &b){
       return (a.first < b.first);
}

int main(){
    IO
     LL n, Ones = 0, Zeros = 0;
    char s[N];
    scanf("%lld %s", &n, &s);
    for (int i = 0; i < n; ++i) {
        if (s[i] == '1')Ones++;
        else Zeros++;
    }
    LL x = (n - (LL)((min(Ones, Zeros))* 2));
    printf("%lld\n", x);
}


#include <bits/stdc++.h>
#define S second
#define F first
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using LL = long long;
using LD = long double;
const int mod = 1e9 + 7;
const int N = 1e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
using namespace std ;

bool compare(const pair<int,int> &a, const pair<int,int> &b){
       return (a.first < b.first);
}

int main(){
    IO
    LL n, Ones = 0, Zeros = 0;
    char s[N];
    scanf("%lld%s", &n, &s);
    for (int i = 0; i < n; ++i) {
        if (s[i] == '1')Ones++;
        else Zeros++;
    }
    LL x = (n - (min(Ones, Zeros))* 2);
    printf("%lld\n", x);
}


#include <bits/stdc++.h>
#define S second
#define F first
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using LL = long long;
using LD = long double;
const int mod = 1e9 + 7;
const int N = 1e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
using namespace std ;

int main(){
    IO
    int n, Ones = 0, Zeros = 0;
    char s[N];
    scanf("%d%s", &n, &s[0]);
    for (int i = 0; i < n; ++i) {
        (s[i] & 1)? Ones++ : Zeros++;
    }
    printf("%d\n", (n - (min(Ones, Zeros))* 2 ));
}


#include <bits/stdc++.h>
#define S second
#define F first
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using LL = long long;
using LD = long double;
const int mod = 1e9 + 7;
const int N = 1e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
using namespace std ;

bool compare(const pair<int,int> &a, const pair<int,int> &b){
       return (a.first < b.first);
}

int main(){
    IO
    int n, Ones = 0, Zeros = 0;
    char s[N];
    scanf("%d%s", &n, &s[0]);
    for (int i = 0; i < n; ++i) {
        (s[i] & 1)? Ones++ : Zeros++;
    }
    printf("%lld\n", (LL)(n - (min(Ones, Zeros))* 2 ));
}


#include <bits/stdc++.h>
#define S second
#define F first
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using LL = long long;
using LD = long double;
const int mod = 1e9 + 7;
const int N = 1e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
using namespace std ;

bool compare(const pair<int,int> &a, const pair<int,int> &b){
       return (a.first < b.first);
}

int main(){
    IO
    LL n, Ones = 0, Zeros = 0;
    char s[N];
    scanf("%d%s", &n, &s);
    for (int i = 0; i < n; ++i) {
        if (s[i] & 1)Ones++;
        else Zeros++;
    }
    LL x = (n - (min(Ones, Zeros))* 2);
    printf("%lld\n", x);
}


#include <bits/stdc++.h>
#define S second
#define F first
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using LL = long long;
using LD = long double;
const int mod = 1e9 + 7;
const int N = 1e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
using namespace std ;

bool compare(const pair<int,int> &a, const pair<int,int> &b){
       return (a.first < b.first);
}

int main(){
    IO
     LL n, Ones = 0, Zeros = 0;
    char s[2e5];
    scanf("%lld %s", &n, &s);
    for (int i = 0; i < n; ++i) {
        if (s[i] == '1')Ones++;
        else Zeros++;
    }
    LL x = (n - (LL)((min(Ones, Zeros))* 2));
    printf("%lld\n", x);
}


#include <bits/stdc++.h>
#define S second
#define F first
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using LL = long long;
using LD = long double;
const int mod = 1e9 + 7;
const int N = 1e5+5, M = 1e6+6, OO = 0x3f3f3f3f;
using namespace std ;

bool compare(const pair<int,int> &a, const pair<int,int> &b){
       return (a.first < b.first);
}

int main(){
    IO
    int n, Ones = 0, Zeros = 0;
    char s[N];
    scanf("%d%s", &n, &s[0]);
    for (int i = 0; i < n; ++i) {
        if (s[i] & 1)Ones++;
        else Zeros++;
    }
    printf("%lld\n", (LL)(n - (min(Ones, Zeros))* 2 ));
}