#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
void run() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
}
int main() {
  run();
  int n;
  cin >> n;
  string s;
  cin >> s;
  string ans;
  for (int i = 0; i < n; i++) {
    if (s[i] == '4') {
      ans += "322";
    } else if (s[i] == '8')
      ans += "2227";
    else if (s[i] == '6')
      ans += "35";
    else if (s[i] == '9')
      ans += "7332";
    else {
      if (s[i] != '0' && s[i] != '1') ans += s[i];
    }
  }
  sort(((ans).begin()), ((ans).end()));
  reverse(((ans).begin()), ((ans).end()));
  cout << ans << "\n";
  return 0;
}
