#include <bits/stdc++.h>
using namespace std;
const int mod = 1000 * 1000 * 1000 + 7;
const int INF = 1000 * 1000 * 1000;
const long long LINF = (long long)INF * INF;
string a, ans;
int n;
int32_t main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> a;
  sort((a).begin(), (a).end(), greater<char>());
  while (a.back() <= '1') a.pop_back();
  for (int i = (0); i < ((int)a.size()); i++) {
    int x = a[i] - '0';
    if (x == 2 || x == 3 || x == 5 || x == 7)
      ans += (x + '0');
    else if (x == 4)
      ans += "223";
    else if (x == 6)
      ans += "53";
    else if (x == 8)
      ans += "2227";
    else if (x == 9)
      ans += "3327";
  }
  sort((ans).begin(), (ans).end(), greater<char>());
  cout << ans << '\n';
  return 0;
}
