#include <bits/stdc++.h>
using namespace std;
int N;
long long A[8];
int dp[8][1 << 8];
int use[1 << 8];
int yaku(long long x) {
  int res = 0;
  long long def = x;
  for (long long i = 2; i * i <= x; i++)
    if (x % i == 0) {
      while (x % i == 0) res++, x /= i;
    }
  if (x != 1 && x != def) res++;
  return res;
}
bool is_prime(long long x) {
  for (long long i = 2; i * i <= x; i++)
    if (x % i == 0) {
      return false;
    }
  if (x == 1) return false;
  return true;
}
int main() {
  scanf("%d", &N);
  for (int(i) = 0; (i) < (N); (i)++) scanf("%I64d", &A[i]);
  sort(A, A + N);
  for (int(i) = 0; (i) < (N); (i)++)
    for (int(j) = 0; (j) < (1 << N); (j)++) dp[i][j] = (1 << 30);
  dp[0][1] = yaku(A[0]) + 1;
  for (int(i) = (1); (i) < (N); (i)++) {
    for (int(j) = 0; (j) < (1 << i); (j)++) {
      use[j] = (1 << 30);
      long long lcm = 1;
      for (int(k) = 0; (k) < (N); (k)++)
        if (j >> k & 1) {
          double ff = double(lcm) * A[k];
          if (ff > 1e14) {
            lcm = (1LL << 60);
            break;
          }
          lcm = lcm * A[k];
        }
      if (lcm < (1LL << 60) && A[i] % lcm == 0)
        use[j] = yaku(A[i] / lcm) + (lcm != 1 && is_prime(A[i] / lcm)) + 1;
    }
    for (int(j) = 0; (j) < (1 << N); (j)++)
      if (dp[i - 1][j] < (1 << 30))
        for (int(k) = 0; (k) < (1 << i); (k)++)
          if (((~j) & k) == 0 && use[k] < (1 << 30)) {
            dp[i][(j & (~k)) | (1 << i)] =
                min(dp[i][(j & (~k)) | (1 << i)], dp[i - 1][j] + use[k]);
          }
  }
  int ans = (1 << 30);
  for (int(i) = 0; (i) < (N); (i)++) ans = min(ans, dp[N - 1][1 << i]);
  for (int(i) = 0; (i) < (1 << N); (i)++) ans = min(ans, dp[N - 1][i] + 1);
  printf("%d\n", ans);
}
