#include <bits/stdc++.h>
char sr[20];
int answer[1000];
int main() {
  int N, n = 0;
  scanf("%d", &N);
  scanf("%s", sr);
  for (int i = 0; sr[i]; i++) {
    if (sr[i] < '2') continue;
    if (sr[i] == '3' || sr[i] == '5' || sr[i] == '7' || sr[i] == '2')
      answer[n++] = sr[i] - '0';
    if (sr[i] == '4') {
      answer[n++] = 3;
      answer[n++] = 2;
      answer[n++] = 2;
    }
    if (sr[i] == '6') {
      answer[n++] = 3;
      answer[n++] = 5;
    }
    if (sr[i] == '8') {
      answer[n++] = 2;
      answer[n++] = 2;
      answer[n++] = 2;
      answer[n++] = 7;
    }
    if (sr[i] == '9') {
      answer[n++] = 7;
      answer[n++] = 2;
      answer[n++] = 3;
      answer[n++] = 3;
    }
  }
  std::sort(answer, answer + n);
  for (int i = n - 1; ~i; i--) printf("%d", answer[i]);
  puts("");
  return 0;
}
