#include <bits/stdc++.h>
int count[10];
int main() {
  int n;
  char buf[100];
  char ans[500];
  int idx = 0;
  scanf("%d", &n);
  scanf("%s", buf);
  for (int j = 0; j < 10; j++) {
    count[j] = 0;
  }
  for (int i = 0; i < n; i++) {
    int j = buf[i] - '1' + 1;
    if (j == 9) {
      count[3] += 2;
      count[2]++;
      count[7]++;
    } else if (j == 8) {
      count[2] += 3;
      count[7]++;
    } else if (j == 7) {
      count[7]++;
    } else if (j == 6) {
      count[3]++;
      count[5]++;
    } else if (j == 5) {
      count[5]++;
    } else if (j == 4) {
      count[2] += 2;
      count[3]++;
    } else if (j <= 3) {
      count[j]++;
    }
  }
  for (int j = 7; j > 1; j--) {
    while (count[j] > 0) {
      ans[idx++] = j - 1 + '1';
      count[j]--;
    }
  }
  ans[idx] = '\0';
  printf("%s\n", ans);
  return 0;
}
