#include "bits/stdc++.h" using namespace std; typedef long long ll; #define rep(i,l,r) for(int i=(l);i<(r);i++) #define fcout cout << fixed << setprecision(10) vector card; vector permlist; bool is_prime(ll n){ if (n < 2) return false; if (n < 4) return true; if (!(n % 2)) return false; if (!(n % 3)) return false; ll sq = sqrt(n); for(int i = 5 ;i <= sq; i += 4 - i % 6 / 2){ if (sq < i) return true; if (!(n % i)) return false; } return true; } ll putBack(ll a, int b){ return a * (b < 10 ? 10 : 100) + b; } vector erase(vector v,int pos){ v.erase(v.begin()+pos); return v; } void permutations(vector v,ll cnt){ if(v.size()==1){ permlist.push_back(putBack(cnt, v[0])); return; } rep(i,0,v.size()){ permutations(erase(v,i), putBack(cnt, v[i])); } } int main(){ int n,a; cin >> n; card.reserve(n); rep(i, 0, n){ cin >> a; card.push_back(a); } permlist.push_back(0); permutations(card,0); sort(permlist.begin()+1, permlist.end(), greater()); rep(i,1,permlist.size())if(permlist[i-1]!=permlist[i]&&is_prime(permlist[i])){ cout<