#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, s = 1;
  char a;
  string b[10], c;
  cin >> n;
  b[0] = "";
  b[1] = "";
  b[2] = "2";
  b[3] = "3";
  b[4] = "322";
  b[5] = "5";
  b[6] = "53";
  b[7] = "7";
  b[8] = "7222";
  b[9] = "7332";
  int k = 0;
  int d = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    s = a - 48;
    if (s != 1 && s != 0) c = c + b[s];
  }
  sort(c.begin(), c.end());
  k = c.size();
  for (int i = k - 1; i >= 0; i--) cout << c[i];
  return 0;
}
