#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000005;
int lp[maxn + 1], pr[maxn + 1], primes[100000], cur = 0;
int n, res = 100000000;
long long a[10];
bool prime[10];
void init() {
  for (int i = 2; i < maxn; ++i) {
    if (!lp[i]) {
      lp[i] = i;
      pr[cur++] = i;
    }
    for (int j = 0; j < cur && pr[j] <= lp[i] && i * pr[j] <= maxn; ++j)
      lp[i * pr[j]] = pr[j];
  }
  cur = 0;
  for (int i = 2; i < maxn; ++i) {
    if (lp[i] == i) primes[cur++] = i;
  }
}
int nfactors(long long n) {
  int ans = 0, c = 0;
  bool has = false;
  while (n >= 1ll * maxn) {
    has = false;
    for (; c < cur; ++c)
      if (n % primes[c] == 0) {
        has = true;
        n /= primes[c];
        ++ans;
        break;
      }
    if (!has) return ans + 1;
  }
  for (int k = (int)n; k > 1; k /= lp[k]) ++ans;
  return ans;
}
void grind(int i, int r) {
  if (i == n) {
    int ans = 0;
    for (int j = 0; j < n; ++j)
      if (!prime[j]) ans += nfactors(a[j]);
    ans += n;
    if (r > 1) ans += 1;
    if (ans < res) res = ans;
  } else {
    grind(i + 1, r + 1);
    for (int j = 0; j < i; ++j) {
      if (a[j] % a[i] == 0) {
        a[j] /= a[i];
        grind(i + 1, r);
        a[j] *= a[i];
      }
    }
  }
}
int main() {
  srand(time(0));
  ios_base::sync_with_stdio(0);
  init();
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  sort(a, a + n, greater<long long>());
  for (int i = 0; i < n; ++i) prime[i] = nfactors(a[i]) <= 1;
  grind(1, 1);
  cout << res << '\n';
  return 0;
}
