#include <bits/stdc++.h>
using namespace std;
int n, sum[1100];
char S[1100];
bool used[110][70][16][16];
string ff[110][70][16][16];
int s(int t) {
  int ss = 0;
  for (int i = 1; i <= 9; i++) {
    int tt = i;
    while (tt) ss += sum[i] * (tt / t), tt /= t;
  }
  return ss;
}
string f(int a, int b, int c, int d) {
  if (used[a][b][c][d]) return ff[a][b][c][d];
  string ans = "", tmp;
  for (int i = 2; i <= 9; i++) {
    if (a >= i / 2 + i / 4 + i / 8 && b >= i / 3 + i / 9 && c >= i / 5 &&
        d >= i / 7) {
      tmp = char(i + '0') + f(a - i / 2 - i / 4 - i / 8, b - i / 3 - i / 9,
                              c - i / 5, d - i / 7);
      if (tmp.size() == 1 && a - i / 2 - i / 4 - i / 8 + b - i / 3 - i / 9 + c -
                                     i / 5 + d - i / 7 >
                                 0)
        continue;
      if (tmp.size() > ans.size() || (tmp.size() == ans.size() && tmp > ans))
        ans = tmp;
    }
  }
  used[a][b][c][d] = true;
  return ff[a][b][c][d] = ans;
}
int main() {
  scanf("%d", &n);
  scanf("%s", S);
  for (int i = 0; i < n; i++) {
    sum[S[i] - '0']++;
  }
  cout << f(s(2), s(3), s(5), s(7)) << endl;
}
