#include <bits/stdc++.h>
using namespace std;
char res[20];
int main() {
  int a[10];
  int b[10];
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  int n;
  cin >> n;
  cin >> res;
  for (int i = 0; i < strlen(res); i++) {
    a[res[i] - '0']++;
  }
  for (int i = 0; i <= 9; i++) {
    if (a[i] != 0) {
      switch (i) {
        case 2:
          b[2] += a[i];
          break;
        case 3:
          b[3] += a[i];
          break;
        case 4:
          b[2] += 2 * a[i];
          b[3] += a[i];
          break;
        case 5:
          b[5] += a[i];
          break;
        case 6:
          b[5] += a[i];
          b[3] += a[i];
          break;
        case 7:
          b[7] += a[i];
          break;
        case 8:
          b[7] += a[i];
          b[2] += 3 * a[i];
          break;
        case 9:
          b[7] += a[i];
          b[3] += 2 * a[i];
          b[2] += a[i];
          break;
      }
    }
  }
  for (int i = 9; i >= 2; i--) {
    while (b[i]) {
      cout << i;
      b[i]--;
    }
  }
  cout << endl;
  return 0;
}
