#include <bits/stdc++.h>
using namespace std;
int n, i, s[10], ans, j;
long long x, a[10];
void dfs(int k, int now, int add) {
  if (k > n) {
    ans = min(ans, now + (add > 1));
    return;
  }
  if (s[k] > 1) now++;
  dfs(k + 1, now + s[k], add + 1);
  for (int i = 1; i < k; i++)
    if (a[i] % a[k] == 0) a[i] /= a[k], dfs(k + 1, now, add), a[i] *= a[k];
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  for (i = 1; i <= n; i++) {
    for (x = a[i], j = 2; j * 1LL * j <= x; j++)
      while (x % j == 0) x /= (long long)j, s[i]++;
    s[i] += (x > 1);
  }
  ans = 2100000000;
  dfs(1, 0, 0);
  printf("%d", ans);
  return 0;
}
