#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  cout << fixed;
  cout.precision(10);
  int t = 1;
  while (t--) {
    int n;
    cin >> n;
    string second;
    cin >> second;
    int a[n];
    for (int i = 0; i < n; i++) {
      a[i] = second[i] - '0';
    }
    string s1[] = {"", "1", "2", "3", "322", "5", "53", "7", "7222", "7332"};
    string ans = "";
    for (int i = 0; i < n; i++) {
      if (a[i] > 1) {
        ans += s1[a[i]];
      }
    }
    sort(ans.begin(), ans.end());
    reverse(ans.begin(), ans.end());
    cout << ans << ("\n");
    ;
  }
  return 0;
}
