#include <bits/stdc++.h>
using namespace std;
int main() {
  int len;
  string s;
  cin >> len;
  cin >> s;
  vector<int> res;
  for (auto& i : s) {
    if (i == '0' || i == '1')
      continue;
    else if (i == '2' || i == '3' || i == '5' || i == '7')
      res.push_back(i - '0');
    else {
      if (i == '4') {
        res.push_back(3);
        res.push_back(2);
        res.push_back(2);
      }
      if (i == '6') {
        res.push_back(3);
        res.push_back(5);
      }
      if (i == '8') {
        res.push_back(2);
        res.push_back(2);
        res.push_back(2);
        res.push_back(7);
      }
      if (i == '9') {
        res.push_back(3);
        res.push_back(3);
        res.push_back(2);
        res.push_back(7);
      }
    }
  }
  sort(res.begin(), res.end());
  for (int i = res.size(); i; --i) {
    cout << res[i - 1];
  }
  cout << endl;
  return 0;
}
