#include <bits/stdc++.h>
using namespace std;
int F(char aa) {
  int a = aa - '0';
  if (a == 1 || a == 0) return -1;
  if (a == 2 || a == 5 || a == 7 || a == 3) return a;
  if (a == 4) return 322;
  if (a == 6) return 53;
  if (a == 8) return 7222;
  if (a == 9) return 7332;
}
int32_t main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    int a = s[i] - '0';
    if (a == 2 || a == 5 || a == 7 || a == 3) v.push_back(a);
    if (a == 4) v.push_back(3), v.push_back(2), v.push_back(2);
    if (a == 6) v.push_back(5), v.push_back(3);
    if (a == 8) v.push_back(7), v.push_back(2), v.push_back(2), v.push_back(2);
    if (a == 9) v.push_back(7), v.push_back(3), v.push_back(3), v.push_back(2);
  }
  sort(v.begin(), v.end(), greater<int>());
  for (auto x : v) cout << x;
}
