#include <bits/stdc++.h>
using namespace std;
long long int a[1000006];
char s[1000006];
int main() {
  long long int n, i, x, c;
  scanf("%lld %s", &n, s);
  c = 0;
  for (i = 0; i < n; i++) {
    x = s[i] - '0';
    if (x == 2) a[c++] = 2;
    if (x == 3) a[c++] = 3;
    if (x == 4) {
      a[c++] = 3;
      a[c++] = 2;
      a[c++] = 2;
    }
    if (x == 5) a[c++] = 5;
    if (x == 6) {
      a[c++] = 5;
      a[c++] = 3;
    }
    if (x == 7) a[c++] = 7;
    if (x == 8) {
      a[c++] = 7;
      a[c++] = 2;
      a[c++] = 2;
      a[c++] = 2;
    }
    if (x == 9) {
      a[c++] = 7;
      a[c++] = 3;
      a[c++] = 3;
      a[c++] = 2;
    }
  }
  sort(a, a + c);
  for (i = c - 1; i >= 0; i--) printf("%lld", a[i]);
  return 0;
}
