#include <bits/stdc++.h>
using namespace std;
int n, t[20];
char ch;
bool check(int s) {
  for (int i = 2; i < s; i++)
    if (s % i == 0) return false;
  return true;
}
int main() {
  scanf("%d\n", &n);
  for (int i = 0; i < n; i++) {
    cin >> ch;
    int l = ch - '0';
    for (int i = 2; i <= l; i++) t[i]++;
  }
  int m = 0;
  for (int i = 9; i > 1; i--) {
    t[i] -= m;
    if (t[i] == 0) continue;
    if (check(i)) {
      for (int j = 0; j < t[i]; j++) printf("%d", i);
      m += t[i];
    } else {
      int gg = i;
      for (int j = 2; j < i; j++)
        while (gg % j == 0) {
          t[j] += t[i];
          gg /= j;
        }
    }
  }
  return 0;
}
