#include <bits/stdc++.h>
using namespace std;
int n, add[10], rcnt;
long long ans = (long long)1e16, a[10], cnt[10];
void dfs(int i, int x) {
  if (i > n) {
    long long res = 0;
    for (int j = 1; j <= rcnt; j++) res += cnt[add[j]] == 1 ? 0 : cnt[add[j]];
    ans = min(ans, res + (rcnt > 1) + x);
    return;
  }
  for (int j = 1; j < i; j++)
    if (a[j] % a[i] == 0) {
      a[j] /= a[i];
      dfs(i + 1, x + (cnt[i] != 1));
      a[j] *= a[i];
    }
  add[++rcnt] = i;
  dfs(i + 1, x + 1);
  rcnt--;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + n + 1);
  reverse(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) {
    long long tmp = a[i];
    for (int j = 2; 1ll * j * j <= a[i]; j++)
      while (tmp % j == 0) cnt[i]++, tmp /= j;
    if (tmp > 1) cnt[i]++;
  }
  dfs(1, 0);
  printf("%lld\n", ans);
}
