#include <bits/stdc++.h>
using namespace std;
bool isP(int n) {
  for (int i = 2; i * i <= n; i++)
    if (n % i == 0) return false;
  return true;
}
int main() {
  map<int, int> m;
  int n;
  cin >> n;
  long long a;
  cin >> a;
  while (a) {
    int temp = a % 10;
    if (isP(temp))
      m[temp]++;
    else if (temp == 4) {
      m[3]++;
      m[2] += 2;
    } else if (temp == 6) {
      m[5]++;
      m[3]++;
    } else if (temp == 8) {
      m[7]++;
      m[2] += 3;
    } else if (temp == 9) {
      m[7]++;
      m[3] += 2;
      m[2]++;
    }
    a /= 10;
  }
  for (int i = 9; i >= 2; i--) {
    for (int j = 0; j < m[i]; j++) {
      cout << i;
    }
  }
  return 0;
}
