#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
void solve() {
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  sort(s.begin(), s.end(), greater<char>());
  string ans = "";
  for (long long int i = 0; i < n; i++) {
    if (s[i] == '0' || s[i] == '1') {
      continue;
    } else if (s[i] == '2' || s[i] == '3' || s[i] == '5' || s[i] == '7') {
      ans += s[i];
    } else if (s[i] == '4') {
      ans += "322";
    } else if (s[i] == '6') {
      ans += "53";
    } else if (s[i] == '8') {
      ans += "7222";
    } else if (s[i] == '9') {
      ans += "7332";
    }
  }
  sort(ans.begin(), ans.end(), greater<char>());
  cout << ans << endl;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
  return 0;
}
