#include <bits/stdc++.h>
using namespace std;
bool cmp(long long x, long long y) { return x > y; }
int main() {
  long long n;
  cin >> n;
  string S;
  cin >> S;
  vector<long long> C;
  for (long long i = 0; i < n; i++) {
    long long x = S[i] - '0';
    if (x == 0 || x == 1)
      continue;
    else if (x == 2)
      C.push_back(2);
    else if (x == 3)
      C.push_back(3);
    else if (x == 4)
      C.push_back(2), C.push_back(2), C.push_back(3);
    else if (x == 5)
      C.push_back(5);
    else if (x == 6)
      C.push_back(5), C.push_back(3);
    else if (x == 7)
      C.push_back(7);
    else if (x == 8)
      C.push_back(7), C.push_back(2), C.push_back(2), C.push_back(2);
    else if (x == 9)
      C.push_back(7), C.push_back(3), C.push_back(3), C.push_back(2);
  }
  sort(C.begin(), C.end(), cmp);
  for (auto it : C) cout << it;
}
