#include <bits/stdc++.h>
using namespace std;
string str;
int N, i, k, j;
int cnt[10];
int main() {
  int N;
  cin >> N >> str;
  for (i = 0; i < N; ++i) {
    k = str[i] - '0';
    switch (k) {
      case 0:
        ++cnt[0];
        break;
      case 1:
        ++cnt[0];
        break;
      case 2:
        ++cnt[2];
        break;
      case 3:
        ++cnt[3];
        break;
      case 4:
        cnt[2] += 2, ++cnt[3];
        break;
      case 5:
        ++cnt[5];
        break;
      case 6:
        ++cnt[5], ++cnt[3];
        break;
      case 7:
        ++cnt[7];
        break;
      case 8:
        cnt[2] += 3, ++cnt[7];
        break;
      case 9:
        cnt[3] += 2, ++cnt[2], ++cnt[7];
    }
  }
  for (i = 9; i >= 1; --i)
    for (j = 1; j <= cnt[i]; ++j) cout << i;
  cout << endl;
  return 0;
}
