#include <bits/stdc++.h>
const int maxpri = (int)1e6 + 10;
const int inf = (int)1e9 + 10;
using namespace std;
typedef int arr32[1000020];
arr32 prime;
long long a[10], x[10];
int n, ans, cnt, Y;
int t[10], f[10], d[10];
bool nocir(int z) {
  int v;
  for (int i = 1; i <= z; ++i) {
    v = i;
    ++Y;
    while (v && t[v] < Y) t[v] = Y, v = f[v];
    if (v) return false;
  }
  return true;
}
int solve() {
  int cnt = 0, v = 0;
  for (int i = 1; i <= n; ++i)
    if (t[f[i]] = -1, cnt += 1 + d[i], f[i]) {
      cnt -= d[i];
    } else
      ++v;
  for (int i = 1; i <= n; ++i)
    if (t[i] != -1) cnt -= d[i] == 1;
  if (v > 1)
    return cnt + 1;
  else
    return cnt;
}
void dfs(int z) {
  if (z > n) {
    ans = min(ans, solve());
    return;
  }
  for (int i = 0; i <= n; ++i)
    if (i != z) {
      f[z] = i;
      if (x[f[z]] % a[z] == 0 && nocir(z))
        x[f[z]] /= a[z], dfs(z + 1), x[f[z]] *= a[z];
    }
  f[z] = 0;
}
int main() {
  for (int i = 2; i <= maxpri; ++i) {
    if (!prime[i]) prime[++cnt] = i;
    for (int j = 1; j <= cnt; ++j) {
      if (maxpri / prime[j] < i) break;
      prime[prime[j] * i] = 1;
      if (i % prime[j] == 0) break;
    }
  }
  ans = inf;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    x[i] = a[i];
    long long t = a[i];
    for (int j = 1; j <= cnt && prime[j] <= t; ++j)
      while (t % prime[j] == 0) t /= prime[j], ++d[i];
    if (t > 1) ++d[i];
    printf("\n");
  }
  dfs(1);
  printf("%d", ans);
}
