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

#define fast ios::sync_with_stdio(false); cin.tie(nullptr);
#define ll long long
#define endl '\n'
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()

const int oo = 1e9;
const ll INF = 1e18;


void solve(){
    int n ; cin >> n;
    string s ; cin >> s;
    string ans="";
    map<char, string>m=
    {{'2',"2"} ,
    {'3' , "3"} ,
    {'4',"322"} ,
    {'5' , "5"},
    {'6' , "53"},
    {'7', "7"},
    {'8',"7222"},
    {'9',"7332"}};

    for (int i=0 ; i<n ; i++) {
        if (s[i]=='0'||s[i]=='1') continue;
        ans+=m[s[i]];
    }
    sort(all(ans));
    for (int i=ans.size()-1 ; i>=0 ; i--) cout<<ans[i];
}

int main() {
    fast
    int t = 1; // cin >> t;
    while (t--) solve();
}
