#include <bits/stdc++.h>
using namespace std;
const long long LINF = ~(((long long)0x1) << 63) / 2;
const int INF = 0X3F3F3F3F;
int ok[1111111];
vector<int> prim;
int mark[1111111];
long long di[10];
void init() {
  for (int i = 2; i <= 1000000; i++)
    if (!ok[i])
      for (int j = i + i; j <= 1000000; j += i) ok[j] = 1;
  for (int i = 2; i <= 1000000; i++)
    if (!ok[i]) prim.push_back(i);
}
long long count(long long a) {
  long long cnt = 0;
  for (int i = 0; i < prim.size() && a > 1; i++)
    while (a % prim[i] == 0) {
      cnt++;
      a /= prim[i];
    }
  if (a > 1) cnt++;
  return cnt;
}
vector<long long> c;
long long t[10];
long long solve(vector<long long> a) {
  long long ans = 0;
  for (int i = 0; i < a.size(); i++) t[i] = di[i];
  for (int i = 0; i < a.size(); i++) {
    if (mark[i]) t[mark[i]] -= di[i];
  }
  for (int i = 0; i < a.size(); i++) ans += t[i] - (di[i] == 1);
  ans += a.size();
  int cnt = 0;
  for (int i = 0; i < a.size(); i++)
    if (!mark[i]) cnt++;
  if (cnt > 1) ans++;
  return ans;
}
vector<long long> a;
long long ans;
int n;
void dfs(int u) {
  if (u == n - 1) {
    ans = min(ans, solve(a));
    return;
  }
  for (int i = u + 1; i < a.size(); i++)
    if (a[i] % c[u] == 0) {
      mark[u] = i;
      long long p = a[i];
      a[i] /= c[u];
      dfs(u + 1);
      a[i] = p;
      mark[u] = 0;
    }
  dfs(u + 1);
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    long long k;
    cin >> k;
    a.push_back(k);
  }
  sort(a.begin(), a.end());
  c = a;
  init();
  ans = LINF;
  for (int i = 0; i < a.size(); i++) {
    di[i] = count(a[i]);
  }
  dfs(0);
  cout << ans << endl;
  return 0;
};
