#include <bits/stdc++.h>
using namespace std;
int ans, n, s[10];
long long a[10];
void dfs(int total, int an, int c) {
  if (an >= ans) return;
  if (total == 0) {
    ans = min(ans, an + (c > 1));
    return;
  }
  if (s[total] > 1) an++;
  dfs(total - 1, an + s[total], c + 1);
  for (int i = total + 1; i <= n; ++i) {
    if (a[i] % a[total] == 0) {
      a[i] /= a[total];
      dfs(total - 1, an, c);
      a[i] *= a[total];
    }
  }
}
int main() {
  while (~scanf("%d", &n)) {
    memset(s, 0, sizeof(s));
    for (int i = (1); i <= (n); ++i) {
      scanf("%lld", a + i);
    }
    sort(a + 1, a + 1 + n);
    for (int i = (1); i <= (n); ++i) {
      long long t = a[i], j;
      for (j = 2; j * j <= t; j++)
        while (t % j == 0) t /= j, s[i]++;
      if (t > 1) s[i]++;
    }
    ans = 1e9;
    dfs(n, 0, 0);
    printf("%d\n", ans);
  }
  return 0;
}
