#include <bits/stdc++.h>
using namespace std;
int n;
char ch[21];
vector<char> ve;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> ch[i];
  }
  for (int i = 0; i < n; i++) {
    if (ch[i] != '1' && ch[i] != '0') {
      if (ch[i] == '4') {
        ve.push_back('3');
        ve.push_back('2');
        ve.push_back('2');
      } else if (ch[i] == '6') {
        ve.push_back('3');
        ve.push_back('5');
      } else if (ch[i] == '8') {
        ve.push_back('2');
        ve.push_back('2');
        ve.push_back('2');
        ve.push_back('7');
      } else if (ch[i] == '9') {
        ve.push_back('3');
        ve.push_back('3');
        ve.push_back('2');
        ve.push_back('7');
      } else
        ve.push_back(ch[i]);
    }
  }
  sort(ve.begin(), ve.end());
  reverse(ve.begin(), ve.end());
  for (int i = 0; i < (int)ve.size(); i++) printf("%c", ve[i]);
  printf("\n");
  return 0;
}
