#include <bits/stdc++.h>
using namespace std;
int n, i, j, ans, tot;
int v[12], num[12], son[12][12];
long long a[10], ss[1000000];
int notprime[2000000];
long long last[12], b[12];
void dfs(int x) {
  int i, j, now;
  if (x == n + 1) {
    now = n + 1;
    if (v[0] == 1) now--;
    for (i = 1; i <= n; i++) {
      now = now + num[i];
      for (j = 1; j <= v[i]; j++) now = now - num[son[i][j]];
      if (num[i] == 1 && !v[i]) now--;
    }
    if (now < ans) ans = now;
    return;
  }
  for (i = 0; i <= n; i++)
    if ((i != x) && ((last[i] % a[x] == 0) || (i == 0))) {
      last[i] = last[i] / a[x];
      son[i][++v[i]] = x;
      dfs(x + 1);
      --v[i];
      last[i] = last[i] * a[x];
    }
}
int main() {
  scanf("%d ", &n);
  for (i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  for (i = 2; i <= 1000000; i++) {
    if (!notprime[i]) ss[++tot] = i;
    for (j = 1; ss[j] * i <= 1000000 && j <= tot; j++) {
      notprime[ss[j] * i] = 1;
      if (i % ss[j] == 0) break;
    }
  }
  for (i = 1; i <= n; i++) b[i] = a[i];
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= tot; j++)
      while (b[i] % ss[j] == 0) num[i]++, b[i] = b[i] / ss[j];
    if (b[i] > 1) num[i]++;
  }
  ans = 1000000;
  for (i = 1; i <= n; i++) last[i] = a[i];
  dfs(1);
  printf("%d", ans);
  return 0;
}
