#include <bits/stdc++.h>
using namespace std;
string f(char n) {
  if (n == '0' || n == '1') {
    return "";
  }
  if (n == '2') {
    return "2";
  }
  if (n == '3') {
    return "3";
  }
  if (n == '4') {
    return "322";
  }
  if (n == '5') {
    return "5";
  }
  if (n == '6') {
    return "53";
  }
  if (n == '7') {
    return "7";
  }
  if (n == '8') {
    return "7222";
  }
  return "7332";
}
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  string o = "";
  for (int i = 0; i < n; i++) {
    o += f(s[i]);
  }
  sort(o.begin(), o.end());
  reverse(o.begin(), o.end());
  cout << o;
}
