#include <bits/stdc++.h>
using namespace std;
int ffreq[10], nfreq[10];
int f2(int n) {
  if (n <= 3) return n / 2;
  if (n <= 7) return ceil((n + 1) / 2.0);
  return 7;
}
int f3(int n) {
  if (n < 9) return n / 3;
  return 4;
}
int main() {
  int n;
  string s;
  cin >> n >> s;
  memset(ffreq, 0, sizeof(ffreq));
  memset(nfreq, 0, sizeof(nfreq));
  for (int i = 0; i < n; i++) {
    ffreq[2] += f2(s[i] - '0');
    nfreq[3] += f3(s[i] - '0');
    nfreq[5] += (s[i] - '0') / 5;
    nfreq[7] += (s[i] - '0') / 7;
  }
  ffreq[7] += nfreq[7];
  nfreq[5] -= nfreq[7];
  nfreq[3] -= 2 * nfreq[7];
  ffreq[2] -= 4 * nfreq[7];
  ffreq[5] += nfreq[5];
  nfreq[3] -= nfreq[5];
  ffreq[2] -= 3 * nfreq[5];
  ffreq[3] += nfreq[3];
  ffreq[2] -= nfreq[3];
  for (int i = 9; i >= 2; i--) {
    while (ffreq[i]) {
      cout << i;
      ffreq[i]--;
    }
  }
  cout << "\n";
  return 0;
}
