#include <bits/stdc++.h>
using namespace std;
const int MAXP = 1000010;
const int INF = 0x3f3f3f3f;
int n;
long long a[10];
int fa[10], ans, di[10];
int pri[MAXP], totpri;
bool isnpri[MAXP];
void prepare() {
  for (int i = 2; i < MAXP; ++i) {
    if (!isnpri[i]) pri[totpri++] = i;
    for (int j = 0; j < totpri && i * pri[j] < MAXP; ++j) {
      isnpri[i * pri[j]] = true;
      if (i % pri[j] == 0) break;
    }
  }
}
int gao(long long x) {
  int ret = 0;
  for (int i = 0; i < totpri && pri[i] <= x / pri[i]; ++i) {
    if (x % pri[i]) continue;
    while (x % pri[i] == 0) x /= pri[i], ++ret;
  }
  if (x > 1) ++ret;
  return ret;
}
void go(int d) {
  if (d == n) {
    int rt = 0, cnt = n;
    for (int i = 0; i < (n); i++) {
      if (fa[i] == -1) ++rt;
      int x = gao(a[i]);
      if (x == 1 && di[i] == 0) continue;
      cnt += x;
    }
    if (rt > 1) ++cnt;
    ans = min(ans, cnt);
    return;
  }
  go(d + 1);
  for (int i = 0; i < (d); i++) {
    if (a[i] % a[d]) continue;
    a[i] /= a[d];
    ++di[i];
    fa[d] = i;
    go(d + 1);
    a[i] *= a[d];
    --di[i];
    fa[d] = -1;
  }
}
int main() {
  prepare();
  while (cin >> n) {
    for (int i = 0; i < (n); i++) cin >> a[i];
    sort(a, a + n, greater<long long>());
    ans = INF;
    memset(fa, 0xff, sizeof(fa));
    memset(di, 0, sizeof(di));
    go(0);
    cout << ans << endl;
  }
  return 0;
}
