#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n;
  cin >> s;
  map<int, int> xxx;
  n = s.length();
  int tmp2;
  for (int i = 0; i < n; i++) {
    tmp2 = s[i] - 48;
    if (tmp2 == 4) {
      xxx[2] += 2;
      xxx[3]++;
    } else if (tmp2 == 6) {
      xxx[5]++;
      xxx[3]++;
    } else if (tmp2 == 8) {
      xxx[2] += 3;
      xxx[7]++;
    } else if (tmp2 == 9) {
      xxx[7]++;
      xxx[3] += 2;
      xxx[2]++;
    } else {
      xxx[tmp2]++;
    }
  }
  int tmp;
  for (int i = 9; i >= 2; i--) {
    tmp = xxx[i];
    for (int j = 1; j <= tmp; j++) cout << i;
  }
  cout << endl;
}
