#include <bits/stdc++.h>
using namespace std;
int ans[65] = {0}, m = 0;
void add(int temp) {
  if (temp == 0 || temp == 1)
    return;
  else if (temp == 4) {
    ans[m++] = 2;
    ans[m++] = 2;
    ans[m++] = 3;
  } else if (temp == 6) {
    ans[m++] = 3;
    ans[m++] = 5;
  } else if (temp == 8) {
    ans[m++] = 2;
    ans[m++] = 2;
    ans[m++] = 2;
    ans[m++] = 7;
  } else if (temp == 9) {
    ans[m++] = 2;
    ans[m++] = 3;
    ans[m++] = 3;
    ans[m++] = 7;
  } else {
    ans[m++] = temp;
  }
}
bool compare(int a, int b) { return a > b; }
int main() {
  int n;
  while (cin >> n) {
    char temp;
    memset(ans, 0, sizeof(ans));
    m = 0;
    for (int i = 0; i < n; ++i) {
      cin >> temp;
      add(temp - '0');
    }
    sort(ans, ans + m, compare);
    for (int i = 0; i < m; ++i) cout << ans[i];
  }
  return 0;
}
