#include <bits/stdc++.h>
struct Complex {
  double x, y;
  Complex(double _x = 0.0, double _y = 0.0) : x(_x), y(_y) {}
};
Complex operator+(Complex a, Complex b) {
  return Complex(a.x + b.x, a.y + b.y);
}
Complex operator-(Complex a, Complex b) {
  return Complex(a.x - b.x, a.y - b.y);
}
Complex operator*(Complex a, Complex b) {
  return Complex(a.x * b.x - a.y * b.y, a.x * b.y + a.y * b.x);
}
using namespace std;
map<long long, long long> mp;
int n, fa[136], son[136];
long long a[136], has[136];
long long ans;
long long prim[2111111], pp[2111111], sum = 0;
long long cnt;
int num[136];
void makeprim() {
  for (long long i = 2; i < 2111111; i++) {
    if (prim[i] != 0) continue;
    pp[sum++] = i;
    for (long long j = i * i; j < 2111111; j += i) prim[j] = i;
  }
}
void dfs(int now) {
  if (now == n + 1) {
    long long temp = 0;
    for (int i = 1; i <= (n); i++) {
      if (has[i] == 1) continue;
      long long fenjie = has[i];
      long long cnt = 0;
      long long j = 0;
      while (fenjie != 1 && j < sum) {
        if (pp[j] * pp[j] > fenjie) break;
        num[cnt] = 0;
        while (fenjie % pp[j] == 0) {
          fenjie /= pp[j];
          num[cnt]++;
        }
        if (num[cnt]) cnt++;
        j++;
      }
      if (fenjie != 1) num[cnt++] = 1;
      long long all = 0;
      for (int t = 0; t < (cnt); t++) all += num[t];
      mp[has[i]] = all;
      if (son[i] == 0 && all == 1) all = 0;
      temp += all;
    }
    int ss = 0;
    for (int i = 1; i <= (n); i++)
      if (fa[i] == -1) ss++;
    if (ss > 1) temp++;
    ans = min(ans, temp + n);
    return;
  }
  dfs(now + 1);
  for (int i = 1; i <= (n); i++) {
    if (i == now) continue;
    bool flag1 = true;
    int j = fa[i];
    while (j != -1) {
      if (j == now) {
        flag1 = false;
        break;
      }
      j = fa[j];
    }
    if (!flag1) continue;
    if (has[i] % a[now]) continue;
    has[i] /= a[now];
    fa[now] = i;
    son[i]++;
    dfs(now + 1);
    has[i] *= a[now];
    fa[now] = -1;
    son[i]--;
  }
}
long long dp[136][136];
long long p2[136];
int main() {
  makeprim();
  ans = 0X7FFFFFFFll;
  cin >> n;
  for (int i = 1; i <= (n); i++) cin >> a[i];
  for (int i = 1; i <= (n); i++) has[i] = a[i];
  for (int i = 1; i <= (n); i++) fa[i] = -1;
  dfs(1);
  cout << ans << endl;
  return 0;
}
