#include <bits/stdc++.h>
using namespace std;
int n;
long long a[10];
int fa[10], cnt[10], s[10], ans;
void go(int d) {
  if (d == n) {
    int tot = s[n] == 1 ? 0 : 1;
    for (int i = 0; i < (n); i++) {
      if (fa[i] == n) {
        tot += cnt[i];
        if (cnt[i] > 1) ++tot;
      } else if (cnt[i] > 1)
        ++tot;
    }
    ans = min(ans, tot);
    return;
  }
  ++s[fa[d] = n];
  go(d + 1);
  --s[n];
  for (int i = 0; i < (d); i++) {
    if (a[i] % a[d] == 0) {
      a[i] /= a[d];
      fa[d] = i;
      go(d + 1);
      a[i] *= a[d];
    }
  }
}
int main() {
  while (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++) {
      long long x = a[i];
      cnt[i] = 0;
      for (long long j = 2; j * j <= x; ++j) {
        while (x % j == 0) x /= j, ++cnt[i];
      }
      if (x > 1) ++cnt[i];
    }
    memset(s, 0, sizeof(s));
    ans = 0x3f3f3f3f;
    go(0);
    cout << ans << endl;
  }
  return 0;
}
