#include <bits/stdc++.h>
using namespace std;
long long a[8], fa[8];
int primCnt, prim[8], n, ans = 99999999, restPrim[8];
bool used[8];
void dfs(int deep, int sum) {
  if (deep == n) {
    int cnt = 0;
    for (int i = 0; i < n; ++i) {
      if (!used[i]) ++cnt;
    }
    ans = min(ans, sum + (cnt > 1));
    return;
  }
  for (int i = deep; i < n; ++i) {
    if (i == deep) {
      dfs(deep + 1, sum + restPrim[i]);
    } else {
      if (fa[i] % a[deep] == 0) {
        used[deep] = 1;
        fa[i] /= a[deep];
        restPrim[i] -= prim[deep];
        dfs(deep + 1, sum + restPrim[deep]);
        used[deep] = 0;
        fa[i] *= a[deep];
        restPrim[i] += prim[deep];
      }
    }
  }
}
int main() {
  cin >> n;
  int i, j;
  for (i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (i = 0; i < n; ++i) {
    fa[i] = a[i];
    long long t = a[i];
    for (j = 2; (long long)j * j <= a[i]; ++j) {
      if (t % j == 0) {
        while (t % j == 0) {
          t /= j;
          ++prim[i];
        }
      }
    }
    if (t > 1) ++prim[i];
    if (prim[i] == 1) ++primCnt;
    restPrim[i] = prim[i];
  }
  dfs(0, 0);
  cout << ans + n - primCnt << endl;
  return 0;
}
