#include <bits/stdc++.h>
using namespace std;
long long x, a[12], j;
int b[12], ans = 1000000, n, i, fa[12], du[12];
void dfs(int l) {
  if (0 == l) {
    int num = 0, d = 0;
    for (int i = 1; i <= n; ++i)
      if (fa[i] == n + 1) {
        num++;
        d += b[i];
      }
    if (num != 1) d++;
    for (int i = 1; i <= n; ++i)
      if (du[i] == 0 && b[i] == 1) d--;
    ans = min(ans, d + n);
    return;
  }
  for (int i = l + 1; i <= n + 1; ++i)
    if (a[i] % a[l] == 0) {
      du[i]++;
      a[i] /= a[l];
      fa[l] = i;
      dfs(l - 1);
      a[i] *= a[l];
      du[i]--;
    }
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  sort(a + 1, a + n + 1);
  for (i = 1; i <= n; i++) {
    x = a[i];
    for (j = 2; j * j <= x; ++j)
      while (x % j == 0) {
        x /= j;
        b[i]++;
      }
    if (x != 1) b[i]++;
  }
  dfs(n);
  printf("%d\n", ans);
  return 0;
}
