#include <bits/stdc++.h>
using namespace std;
long long limit = 4294967296;
int MOD = 1000000007;
template <typename T>
void print(const T& x) {
  cerr << x << ' ';
}
template <typename T1, typename... T2>
void print(const T1& first, const T2&... rest) {
  print(first);
  print(rest...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> res;
  for (int i = 0; i < n; i++) {
    int x = s[i] - '0';
    if (x == 2 || x == 3 || x == 5 || x == 7) {
      res.push_back(x);
    } else if (x == 4) {
      res.push_back(2);
      res.push_back(2);
      res.push_back(3);
    } else if (x == 8) {
      res.push_back(7);
      res.push_back(2);
      res.push_back(2);
      res.push_back(2);
    } else if (x == 6) {
      res.push_back(5);
      res.push_back(3);
    } else if (x == 9) {
      res.push_back(7);
      res.push_back(2);
      res.push_back(3);
      res.push_back(3);
    }
  }
  sort(res.rbegin(), res.rend());
  for (auto it : res) cout << it;
}
