#include <bits/stdc++.h>
using namespace std;
long long prime[100007];
int c1;
bool pr[1000007];
void pre() {
  for (int i = 3; i < 1000007; i += 2) pr[i] = true;
  pr[2] = true;
  prime[c1++] = 2;
  for (int i = 3; i < 1000007; i += 2) {
    if (pr[i]) {
      prime[c1++] = i;
      for (int j = 2 * i; j < 1000007; j += i) pr[j] = false;
    }
  }
}
vector<int> direct[(1 << 9)];
vector<int> ans[(1 << 9)];
vector<int> val[(1 << 9)];
long long no[10];
int n;
long long fact(long long p) {
  int cnt = 0;
  for (int i = 0; i < c1 && prime[i] * prime[i] <= p; i++) {
    while (p % prime[i] == 0) p /= prime[i], cnt++;
  }
  if (p != 1) cnt++;
  return cnt;
}
int dp[(1 << 8)][9][(1 << 8)];
bool vis[(1 << 8)][9][(1 << 8)];
long long Gv[10];
int back(int mask, int pos, int tg) {
  if (vis[mask][pos][tg]) return dp[mask][pos][tg];
  vis[mask][pos][tg] = true;
  dp[mask][pos][tg] = (1 << 29);
  if (pos == val[mask].size()) {
    if (tg == 0) dp[mask][pos][tg] = 0;
    return dp[mask][pos][tg];
  }
  if (val[mask].size() == 1) {
    int cur = val[mask][0];
    if (tg == mask) {
      dp[mask][pos][tg] = 1 + Gv[cur];
      return dp[mask][pos][tg];
    }
    for (int i = 0; i < direct[val[mask][0]].size(); i++) {
      int nmask = direct[val[mask][0]][i];
      if ((nmask & tg) == nmask) {
        dp[mask][pos][tg] =
            min(dp[mask][pos][tg],
                1 + ans[val[mask][0]][i] + back(nmask, 0, (tg ^ (1 << cur))));
      }
    }
    return dp[mask][pos][tg];
  }
  for (int i = tg; i > 0; i = ((i - 1) & tg)) {
    int cur = val[mask][pos];
    if (i & (1 << cur))
      dp[mask][pos][tg] = min(dp[mask][pos][tg], back(mask, pos + 1, (tg ^ i)) +
                                                     back((1 << cur), 0, i));
  }
  return dp[mask][pos][tg];
}
int main() {
  pre();
  cin >> n;
  for (int i = 0; i < n; i++) cin >> no[i];
  for (int i = 0; i < n; i++) {
    Gv[i] = fact(no[i]);
    if (Gv[i] == 1) Gv[i] = 0;
  }
  for (int i = 0; i < (1 << n); i++) {
    for (int j = 0; j < n; j++) {
      if ((1 << j) & i) val[i].push_back(j);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < (1 << n); j++) {
      if ((1 << i) & j) continue;
      long long tmp = no[i];
      for (int k = 0; k < n; k++) {
        if ((1 << k) & j) {
          if (tmp % no[k] != 0) {
            tmp = -1;
            break;
          }
          tmp /= no[k];
        }
      }
      if (tmp != -1) direct[i].push_back(j), ans[i].push_back(fact(tmp));
    }
  }
  int ret = (1 << 29);
  for (int i = 1; i < (1 << n); i++) {
    int fn = 0;
    if (val[i].size() > 1) {
      fn++;
    }
    fn = fn + back(i, 0, (1 << n) - 1);
    if (fn < ret) ret = fn;
  }
  printf("%d\n", ret);
  return 0;
}
