#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  string s;
  cin >> s;
  string ans;
  for (int i = 0; i < n; i++) {
    if (s[i] == '6') {
      ans += "53";
    } else if (s[i] == '4') {
      ans += "322";
    } else if (s[i] == '8') {
      ans += "2227";
    } else if (s[i] == '9') {
      ans += "3327";
    } else if (s[i] != '0' && s[i] != '1') {
      ans += s[i];
    }
  }
  sort(ans.begin(), ans.end(), greater<int>());
  cout << ans;
}
