#include <bits/stdc++.h>
using namespace std;
int me[10];
vector<int> ans;
void limon(int ara[]) {
  int i, j;
  for (i = 9; i >= 2;) {
    if (me[i] >= 1) {
      ans.push_back(i);
      for (j = 2; j <= i; j++) {
        if (j == 4)
          me[2] -= 2;
        else if (j == 6) {
          me[2] -= 1, me[3] -= 1;
        } else if (j == 8)
          me[2] -= 3;
        else if (j == 9)
          me[3] -= 2;
        else
          --me[j];
      }
    } else
      --i;
  }
  if (!ans.size()) ans.push_back(1);
}
void four() { me[2] += 2; }
void six() { me[2] += 1, me[3] += 1; }
void eight() { me[2] += 3; }
void nine() { me[3] += 2; }
int main() {
  int n, i, j, k;
  string str;
  while (cin >> n) {
    getchar();
    ans.clear();
    int ara[n];
    memset(me, 0, sizeof me);
    cin >> str;
    i = n - 1;
    k = 0;
    bool b = false;
    for (i = 0; i < str.length(); i++) {
      if (str[i] == '0' && b == false)
        continue;
      else {
        ara[k++] = str[i] - '0';
        b = true;
      }
    }
    for (i = 0; i < k; i++) {
      for (j = 2; j <= ara[i]; j++) {
        if (j == 4)
          four();
        else if (j == 6)
          six();
        else if (j == 8)
          eight();
        else if (j == 9)
          nine();
        else
          ++me[j];
      }
    }
    limon(me);
    sort(ans.begin(), ans.end(), greater<int>());
    for (i = 0; i < ans.size(); i++) {
      cout << ans[i];
    }
    cout << endl;
  }
  return 0;
}
