#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 1000010;
int n;
long long a[9], sum[1 << 8 | 1];
int dp[1 << 8 | 1][1 << 8 | 1], cnt[1 << 8 | 1];
map<long long, int> h;
int p[N], num;
bool flag[N];
void make_p() {
  memset(flag, true, sizeof(flag));
  for (int i = 2; i < N; i++) {
    if (flag[i]) p[num++] = i;
    for (int j = 0; p[j] * i < N && j < num; j++) {
      flag[p[j] * i] = 0;
      if (i % p[j]) break;
    }
  }
}
int cal(long long x) {
  long long t = x;
  if (h.find(x) != h.end()) return h[x];
  int ret = 0;
  for (int i = 0; 1ll * p[i] * p[i] <= x; i++)
    while (x % p[i] == 0) ret++, x /= p[i];
  if (x > 1) ret++;
  return h[t] = ret;
}
int DP(int x, int y) {
  int &ret = dp[x][y];
  if (ret + 1) return ret;
  ret = 0;
  if ((x | y) == (1 << n) - 1) {
    for (int i = 0; i < n; i++)
      if ((y & (1 << i)) && cal(a[i]) > 1) ret += cal(a[i]);
    return ret;
  }
  ret = inf;
  for (int k = 0; k < n; k++) {
    if ((y & (1 << k)) == 0) continue;
    for (int i = 1; i < (1 << n); i++) {
      if ((x | y) & i) continue;
      if (a[k] % sum[i]) continue;
      int tx = x | (1 << k);
      int ty = y ^ (1 << k);
      ty |= i;
      ret = min(ret, DP(tx, ty) + cal(a[k] / sum[i]) + cnt[i]);
    }
  }
  return ret;
}
void init() {
  make_p();
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%I64d", &a[i]);
}
void solve() {
  int mask = 1 << n;
  for (int i = 0; i < mask; ++i) {
    sum[i] = 1;
    cnt[i] = 0;
    for (int j = 0; j < n; ++j)
      if (i & (1 << j)) {
        if (1.0 * sum[i] * a[j] > 1e13)
          sum[i] = 1e13;
        else
          sum[i] = sum[i] * a[j];
        cnt[i]++;
      }
  }
  memset(dp, -1, sizeof(dp));
  int ret = inf;
  for (int i = 1; i < mask; ++i) {
    int t = DP(0, i) + cnt[i];
    if (cnt[i] > 1) t++;
    ret = min(ret, t);
  }
  printf("%d\n", ret);
}
int main() {
  init();
  solve();
  return 0;
}
