#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string str;
  cin >> str;
  vector<int> ans;
  for (int i = 0; i < n; i++) {
    if (str[i] == '9') {
      ans.push_back(7);
      ans.push_back(3);
      ans.push_back(3);
      ans.push_back(2);
    } else if (str[i] == '8') {
      ans.push_back(7);
      ans.push_back(2);
      ans.push_back(2);
      ans.push_back(2);
    } else if (str[i] == '7') {
      ans.push_back(7);
    } else if (str[i] == '6') {
      ans.push_back(5);
      ans.push_back(3);
    } else if (str[i] == '5') {
      ans.push_back(5);
    } else if (str[i] == '4') {
      ans.push_back(3);
      ans.push_back(2);
      ans.push_back(2);
    } else if (str[i] == '3') {
      ans.push_back(3);
    } else if (str[i] == '2') {
      ans.push_back(2);
    }
  }
  sort(ans.begin(), ans.end(), greater<int>());
  for (int i = 0; i < ans.size(); i++) {
    cout << ans[i];
  }
  cout << endl;
  return 0;
}
