#include <bits/stdc++.h>
using namespace std;
long long modpow(long long x, long long n, long long mod) {
  long long res = 1;
  for (; n; n >>= 1, x = x * x % mod)
    if (n & 1) res = res * x % mod;
  return res;
}
const double eps = 1e-8, PI = acos(-1.0);
const int N = 2e3 + 10, M = 1e6 + 10, INF = 0x3f3f3f3f, mod = 1e9 + 7;
int ans[N], cnt, num[10], fac[10];
char s[20];
bool ok[10];
int main() {
  fac[0] = ok[2] = ok[3] = ok[5] = ok[7] = 1;
  int n;
  scanf("%d", &(n));
  scanf("%s", s + 1);
  for (int i = (1); i <= (n); ++i) {
    num[s[i] - '0']++;
  }
  for (int i = (9); i >= (2); --i) {
    if (!num[i]) continue;
    if (ok[i]) {
      for (; num[i]; num[i]--) {
        ans[++cnt] = i;
      }
      continue;
    }
    int j, now = 1;
    for (j = i; !ok[j]; j--) {
      now *= j;
    }
    num[j] += num[i];
    while (now % 6 == 0) now /= 6, num[3] += num[i];
    while (now % 2 == 0) now /= 2, num[2] += num[i];
    num[i] = 0;
  }
  for (int i = (1); i <= (cnt); ++i) {
    printf("%d", ans[i]);
  }
  return 0;
}
