#include <bits/stdc++.h>
using namespace std;
const int maxn = 15 + 13;
const int modn = 1e9 + 7;
string s;
int n;
int a[maxn];
vector<int> nums;
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  cin >> n;
  cin >> s;
  for (int i = 0; i < s.length(); i++) {
    int x = s[i] - '0';
    if (x == 3 || x == 5 || x == 7 || x == 2) nums.push_back(x);
    if (x == 4) {
      nums.push_back(3);
      nums.push_back(2);
      nums.push_back(2);
    }
    if (x == 8) {
      nums.push_back(7);
      nums.push_back(2);
      nums.push_back(2);
      nums.push_back(2);
    }
    if (x == 9) {
      nums.push_back(7);
      nums.push_back(3);
      nums.push_back(3);
      nums.push_back(2);
    }
    if (x == 6) {
      nums.push_back(3);
      nums.push_back(5);
    }
  }
  sort(nums.begin(), nums.end());
  reverse(nums.begin(), nums.end());
  for (int i = 0; i < nums.size(); i++) cout << nums[i];
  return 0;
}
