#include <bits/stdc++.h>
int n;
int data[35];
int table[10];
char st[35];
int main() {
  int i;
  scanf("%d", &n);
  scanf("%s", st + 1);
  for (i = 1; i <= n; i++) {
    data[i] = st[i] - '0';
  }
  for (i = 1; i <= n; i++) {
    switch (data[i]) {
      case 1:
        break;
      case 2:
        table[2]++;
        break;
      case 3:
        table[3]++;
        break;
      case 4:
        table[3]++;
        table[2] += 2;
        break;
      case 5:
        table[5]++;
        break;
      case 6:
        table[5]++;
        table[3]++;
        break;
      case 7:
        table[7]++;
        break;
      case 8:
        table[7]++;
        table[2] += 3;
        break;
      case 9:
        table[7]++;
        table[2]++;
        table[3] += 2;
        break;
      default:
        break;
    }
  }
  for (i = 9; i >= 2; i--) {
    for (int a = 1; a <= table[i]; a++) {
      printf("%d", i);
    }
  }
  printf("\n");
  return 0;
}
