#include <bits/stdc++.h>
using namespace std;
int cnt[100];
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    char x;
    cin >> ws >> x;
    if (x == '2' || x == '3' || x == '5' || x == '7') {
      cnt[x - '0']++;
    }
    if (x == '4') cnt[3]++, cnt[2] += 2;
    if (x == '6') cnt[5]++, cnt[3]++;
    if (x == '8') cnt[7]++, cnt[2] += 3;
    if (x == '9') cnt[7]++, cnt[3] += 2, cnt[2]++;
  }
  for (int i = 9; i >= 2; i--) {
    for (int j = 0; j < cnt[i]; j++) cout << i;
  }
  return 0;
}
