#include <bits/stdc++.h>
using namespace std;
int n, q[10], ans[100];
string s;
int a[16], len;
int main() {
  cin >> n;
  cin >> s;
  int sz = 0;
  for (int i = 0; i < s.size(); ++i) a[i + 1] = s[i] - '0';
  for (int i = 1; i <= n; ++i) {
    if (i == 2) i = 2;
    for (int k = 2; k <= a[i]; ++k) {
      int x = k;
      int j = 2;
      while (j * j <= x) {
        while (x % j == 0) {
          q[j]++;
          x /= j;
        }
        j++;
      }
      if (x > 1) q[x]++;
    }
  }
  cerr << 1;
  for (int i = 9; i > 1; --i) {
    while (q[i]) {
      for (int j = i; j >= 2; --j) {
        int x = j;
        int k = 2;
        while (k * k <= x) {
          while (x % k == 0) {
            q[k]--;
            x /= k;
          }
          k++;
        }
        if (x > 1) q[x]--;
      }
      ans[++len] = i;
    }
  }
  sort(ans + 1, ans + len + 1);
  for (int i = len; i >= 1; --i) cout << ans[i];
}
