#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const long long MOD = 998244353;
int main() {
  int n, cnt[10];
  char s[20];
  memset(cnt, 0, sizeof(cnt));
  scanf("%d%s", &n, s);
  for (int i = 0; i < n; i++) {
    if (s[i] == '9') {
      cnt[7]++;
      cnt[3] += 2;
      cnt[2]++;
    } else if (s[i] == '8') {
      cnt[2] += 3;
      cnt[7]++;
    } else if (s[i] == '6') {
      cnt[5]++;
      cnt[3]++;
    } else if (s[i] == '4') {
      cnt[2] += 2;
      cnt[3]++;
    } else
      cnt[s[i] - '0']++;
  }
  for (int i = 7; i >= 2; i--) {
    for (int j = 0; j < cnt[i]; j++) printf("%d", i);
  }
  puts("");
  return 0;
}
