#include <bits/stdc++.h>
using namespace std;
template <typename T>
T sqr(const T &x) {
  return x * x;
}
template <typename T>
T my_abs(const T &x) {
  return x < 0 ? -x : x;
}
const int INF = (int)1e9;
const long long LINF = (long long)4e18;
const long double EPS = 1e-9;
const long long MOD = (int)1e9 + 7;
const int dx[] = {-1, 0, 0, 1};
const int dy[] = {0, -1, 1, 0};
const int N = (int)6e5 + 10;
const int SQN = 400;
const int LOGN = 30;
int fact[10];
string m[10];
string per(int n) {
  if (n == 1) {
    return "";
  }
  string res = "-";
  for (int i = 9; i > 1; i--) {
    if (n % fact[i] == 0) {
      string cur = "";
      cur.push_back(char(char(i) + '0'));
      cur.append(per(n / fact[i]));
      if (cur[cur.length() - 1] == '-') {
        continue;
      }
      if (cur.length() > res.length()) {
        res = cur;
      } else {
        res = max(res, cur);
      }
    }
  }
  return res;
}
void solve() {
  fact[0] = 1;
  for (int i = 1; i < int(10); ++i) {
    fact[i] = fact[i - 1] * i;
  }
  for (int i = 1; i < int(10); ++i) {
    m[i] = per(fact[i]);
  }
  int n;
  cin >> n;
  string s;
  cin >> s;
  string ans = "";
  for (int i = 0; i < int(n); ++i) {
    if (s[i] - '0' > 1) {
      ans.append(m[s[i] - '0']);
    }
  }
  sort(ans.begin(), ans.end());
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}
int main() {
  cout << setprecision(10) << fixed;
  solve();
  return 0;
}
