#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
template <typename T>
T pow(T a, T b, long long int m) {
  T ans = 1;
  while (b > 0) {
    if (b % 2 == 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans % m;
}
const int MAX = (int)1e4 + 5;
void solveTestCases() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> res;
  for (int i = 0; i < n; i++) {
    char num = s[i];
    if (num == '0' || num == '1') {
      continue;
    } else if (num == '2') {
      res.push_back(2);
    } else if (num == '3') {
      res.push_back(3);
    } else if (num == '4') {
      res.push_back(2);
      res.push_back(3);
      res.push_back(2);
    } else if (num == '5') {
      res.push_back(5);
    } else if (num == '6') {
      res.push_back(3);
      res.push_back(5);
    } else if (num == '7') {
      res.push_back(7);
    } else if (num == '8') {
      res.push_back(2);
      res.push_back(2);
      res.push_back(2);
      res.push_back(7);
    } else if (num == '9') {
      res.push_back(3);
      res.push_back(3);
      res.push_back(2);
      res.push_back(7);
    }
  }
  sort(res.begin(), res.end(), greater<int>());
  for (auto x : res) {
    cout << x;
  }
  cout << "\n";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int t;
  t = 1;
  while (t--) {
    solveTestCases();
  }
  return 0;
}
