#include <bits/stdc++.h>
using namespace std;
void read() {
  char x;
  int n;
  cin >> n;
  vector<int> res;
  for (int i = 0; i < n; ++i) {
    cin.get(x);
    if (!isdigit(x)) i--;
    if (x == '0' && x == '1') continue;
    if (x == '2' || x == '3' || x == '5' || x == '7') res.push_back((x - '0'));
    if (x == '4') res.push_back(3), res.push_back(2), res.push_back(2);
    if (x == '6') res.push_back(5), res.push_back(3);
    if (x == '8')
      res.push_back(7), res.push_back(2), res.push_back(2), res.push_back(2);
    if (x == '9')
      res.push_back(7), res.push_back(3), res.push_back(3), res.push_back(2);
  }
  sort(res.begin(), res.end(), greater<int>());
  for (auto it : res) cout << it;
}
int main() {
  read();
  return 0;
}
