#include <bits/stdc++.h>
using namespace std;
const int MAXN = 8 + 5, INF = 0x7fffffff;
int n, ge[MAXN], f[MAXN], _min = INF;
long long a[MAXN];
bool cmp(const long long &a, const long long &b) { return a > b; }
void solve();
void DFS(int k) {
  if (k == n + 1) {
    solve();
    return;
  }
  long long b[MAXN];
  for (int i = 1; i <= n; ++i) b[i] = a[i];
  for (int i = 1; i < k; ++i)
    if (a[i] % a[k] == 0) {
      a[i] /= a[k];
      f[k] = i;
      DFS(k + 1);
      for (int j = 1; j <= n; ++j) a[j] = b[j];
    }
  f[k] = k;
  DFS(k + 1);
  return;
}
void solve() {
  int root[MAXN] = {0}, ans = n;
  for (int i = 1; i <= n; ++i)
    if (f[i] == i) {
      root[++root[0]] = i;
    }
  for (int i = 1; i <= root[0]; ++i) ans += ge[root[i]];
  if (root[0] > 1) ++ans;
  for (int i = 1; i <= n; ++i)
    if (ge[i] == 0 && f[i] != i) --ans;
  _min = min(_min, ans);
}
int calc(long long x) {
  int t, sum = 0, k;
  while (x > 1) {
    t = 0;
    k = (int)sqrt(x + 0.5);
    for (int i = 2; i <= k; ++i)
      if (x % i == 0) {
        t = i;
        while (x && x % t == 0) {
          x /= t;
          ++sum;
        }
        break;
      }
    if (t == 0) {
      ++sum;
      break;
    }
  }
  return sum == 1 ? 0 : sum;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%I64d", &a[i]);
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; ++i) ge[i] = calc(a[i]);
  DFS(1);
  printf("%d\n", _min);
  return 0;
}
