#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long inf = INT_MAX;
long long m_inf = INT_MIN;
bool isprime[1000001];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string arr[] = {"", "", "2", "3", "322", "5", "53", "7", "7222", "7332"};
  long long n;
  cin >> n;
  string str;
  cin >> str;
  string ans;
  for (long long i = 0; i < n; i++) {
    ans += arr[str[i] - '0'];
  }
  sort(ans.begin(), ans.end(), greater<char>());
  cout << ans << '\n';
}
