#include <bits/stdc++.h>
int const N = 10;
int const M = 1000000;
long long num[N], cnt[N], ok[N], tmp, tot[N];
long long y[N];
int n;
long long p, ans;
long long Min(long long a, long long b) { return a < b ? a : b; }
void dfs(int t) {
  if (t >= n) {
    tmp = 0;
    int z = 0;
    for (int i = 0; i < n; i++) {
      if (ok[i] == -1) {
        tmp += cnt[i];
        z++;
      }
    }
    if (z >= 2) tmp++;
    ans = Min(ans, tmp);
    return;
  }
  for (int i = 0; i < n; i++) {
    if (i != t && num[i] % y[t] == 0) {
      num[i] /= y[t];
      ok[t] = i;
      dfs(t + 1);
      ok[t] = -1;
      num[i] *= y[t];
    }
  }
  dfs(t + 1);
}
int main() {
  while (~scanf("%d", &n)) {
    p = 0;
    for (int i = 0; i < n; i++)
      scanf("%I64d", &num[i]), y[i] = num[i], cnt[i] = 0, ok[i] = -1;
    for (int i = 0; i < n; i++) {
      tmp = num[i];
      for (long long j = 2; j * j <= tmp; j++) {
        while (tmp % j == 0) {
          tmp /= j;
          cnt[i]++;
        }
      }
      if (tmp > 1) cnt[i]++;
      if (cnt[i] > 1) p++;
      ans += (cnt[i] + 1);
    }
    dfs(0);
    ans += p;
    printf("%I64d\n", ans);
  }
  return 0;
}
