#include <bits/stdc++.h>
using namespace std;
int N;
long long ip[10];
int fa[10];
int pc[10];
int ans = 12345;
void dfs(int a) {
  if (a == N) {
    int rootC = 0, addC = 0;
    for (int i = 0; i < N; i++) {
      if (fa[i] == -1) {
        rootC++;
        addC += pc[i];
      }
      if (pc[i] == 1) addC--;
    }
    int ans_ = N + (rootC != 1) + addC;
    ans = min(ans, ans_);
    return;
  }
  for (int i = -1; i < a; i++) {
    if ((i >= 0) and (ip[i] % ip[a])) continue;
    fa[a] = i;
    if (i != -1) ip[i] /= ip[a];
    dfs(a + 1);
    if (i != -1) ip[i] *= ip[a];
  }
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> ip[i];
  }
  sort(ip, ip + N, greater<long long>());
  for (int i = 0; i < N; i++) {
    long long t = ip[i];
    for (long long j = 2; j * j <= ip[i]; j++) {
      while (!(t % j)) {
        pc[i]++;
        t /= j;
      }
    }
    if (t > 1) pc[i]++;
  }
  dfs(0);
  cout << ans << endl;
  return 0;
}
