#include <bits/stdc++.h>
using namespace std;
const int maxn = 10;
int n, a[maxn];
string str;
int main() {
  scanf("%d", &n);
  cin >> str;
  for (int i = 0; i < n; i++) {
    int d = str[i] - '0';
    if (d == 4)
      a[3]++, a[2] += 2;
    else if (d == 6)
      a[5]++, a[3]++;
    else if (d == 8)
      a[7]++, a[2] += 3;
    else if (d == 9)
      a[7]++, a[3] += 2, a[2]++;
    else
      a[d]++;
  }
  for (int d = 9; d > 1; d--)
    for (int i = 0; i < a[d]; i++) printf("%d", d);
  return 0;
}
