#include <bits/stdc++.h>
using namespace std;
const long long int inf = 1e+18;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n;
  cin >> n;
  string s;
  cin >> s;
  vector<char> v;
  for (long long int i = 0; i < n; i++) {
    if (s[i] == '1' || s[i] == '0')
      continue;
    else if (s[i] == '4') {
      v.push_back('2');
      v.push_back('2');
      v.push_back('3');
    } else if (s[i] == '8') {
      v.push_back('2');
      v.push_back('2');
      v.push_back('2');
      v.push_back('7');
    } else if (s[i] == '6') {
      v.push_back('3');
      v.push_back('5');
    } else if (s[i] == '9') {
      v.push_back('3');
      v.push_back('3');
      v.push_back('2');
      v.push_back('7');
    } else
      v.push_back(s[i]);
  }
  sort(v.begin(), v.end(), greater<char>());
  for (long long int i = 0; i < v.size(); i++) cout << v[i];
  return 0;
}
