#include <bits/stdc++.h>
using namespace std;
long long a[8], rem[8];
int n;
vector<int> par[8];
map<long long, int> D;
int ans = INT_MAX;
int q;
int d(long long x) {
  int res = 0;
  int temp = sqrt(1.0 * x);
  for (int i = 2; i <= temp; ++i)
    while (x % i == 0) x /= i, ++res;
  return res + (x != 1);
}
void dfs(int depth = 0, int cnt = 0) {
  if (depth == n) {
    cnt += q > 1;
    ans = min(ans, cnt);
    return;
  }
  int dd;
  if ((dd = D[rem[depth]]) == 0) dd = D[rem[depth]] = d(rem[depth]);
  if (rem[depth] != a[depth])
    ++dd;
  else
    dd += dd != 1;
  for (int i = 0; i < par[depth].size(); ++i) {
    if (rem[par[depth][i]] % a[depth]) continue;
    rem[par[depth][i]] /= a[depth];
    dfs(depth + 1, cnt + dd);
    rem[par[depth][i]] *= a[depth];
  }
  ++q;
  dfs(depth + 1, cnt + dd);
  --q;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%I64d", a + i);
  sort(a, a + n);
  memcpy(rem, a, sizeof a);
  for (int i = 0; i < n - 1; ++i)
    for (int j = i + 1; j < n; ++j)
      if (a[j] % a[i] == 0) par[i].push_back(j);
  dfs();
  cout << ans << endl;
  return 0;
}
