#include <bits/stdc++.h>
using namespace std;
char s[20];
int a[500000];
int main() {
  int n;
  while (cin >> n >> s) {
    int an = 0;
    for (int i = 0; i < n; i++) {
      switch (s[i]) {
        case '2':
        case '3':
        case '5':
        case '7':
          a[an++] = s[i] - '0';
          break;
        case '4':
          a[an++] = 2;
          a[an++] = 2;
          a[an++] = 3;
          break;
        case '6':
          a[an++] = 5;
          a[an++] = 3;
          break;
        case '8':
          a[an++] = 7;
          a[an++] = 2;
          a[an++] = 2;
          a[an++] = 2;
          break;
        case '9':
          a[an++] = 7;
          a[an++] = 2;
          a[an++] = 3;
          a[an++] = 3;
          break;
      }
    }
    sort(a, a + an);
    for (int i = an - 1; i >= 0; i--) cout << a[i];
    cout << endl;
  }
}
