#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target(sse, sse2, sse3, ssse3, sse4, popcnt, tune = native)
using namespace std;
const long long inf = 2e9 + 47, MAXN = 100;
long long n;
vector<long long> val;
vector<vector<long long> > mul;
void get_mul(long long a, long long ind) {
  vector<long long> t;
  for (long long d = 2; d * d <= a; d++) {
    while (a % d == 0) {
      t.push_back(d);
      a /= d;
    }
  }
  if (a != 1) t.push_back(a);
  mul[ind] = t;
}
void solve() {
  cin >> n;
  val.resize(n), mul.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> val[i];
  }
  sort(val.begin(), val.end());
  for (long long i = 0; i < n; i++) {
    get_mul(val[i], i);
  }
  long long kok = 1, ans = inf;
  for (long long i = 0; i < n; i++) kok *= (i + 1);
  for (long long mask = 0; mask < kok; mask++) {
    vector<long long> uk(n);
    long long vr = mask;
    for (long long i = 0; i < n; i++) uk[i] = (vr % (n - i)) + i, vr /= (n - i);
    long long root = 0, res = n;
    bool fl = true;
    vector<long long> fk = val, cnt(n);
    for (long long i = 0; i < n; i++) cnt[i] = (long long)(mul[i].size());
    for (long long i = 0; i < n; i++)
      if (cnt[i] == 1) cnt[i] = 0;
    for (long long i = 0; i < n; i++) {
      if (i == uk[i]) {
        root++;
        continue;
      }
      if (fk[uk[i]] % val[i] != 0) {
        fl = false;
        break;
      }
      fk[uk[i]] /= val[i];
      cnt[uk[i]] -= (long long)(mul[i].size());
    }
    if (!fl || root == 0) continue;
    for (long long i = 0; i < n; i++) res += cnt[i];
    if (root > 1) res++;
    ans = min(ans, res);
  }
  cout << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
