#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  char digits[16];
  scanf("%d", &N);
  scanf("%s", digits);
  vector<int> sol;
  for (int i = 0; i < N; i++) {
    switch (digits[i]) {
      case '9':
        sol.push_back(7);
        sol.push_back(3);
        sol.push_back(3);
        sol.push_back(2);
        break;
      case '8':
        sol.push_back(2);
        sol.push_back(2);
        sol.push_back(2);
        sol.push_back(7);
        break;
      case '6':
        sol.push_back(3);
        sol.push_back(5);
        break;
      case '4':
        sol.push_back(2);
        sol.push_back(2);
        sol.push_back(3);
        break;
      case '0':
        break;
      case '1':
        break;
      default:
        sol.push_back(digits[i] - '0');
    }
  }
  sort(sol.begin(), sol.end());
  for (int i = sol.size() - 1; i >= 0; i--) printf("%c", sol[i] + '0');
  printf("\n");
  return 0;
}
