#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7f7f7f7f;
const int N = 1000005;
int n, pc[10], ans, pcnt, plist[N + 1];
long long a[10];
bool is_prime[N + 1];
void init_prime(int n) {
  pcnt = 0;
  memset(is_prime, true, sizeof(is_prime));
  is_prime[0] = is_prime[1] = false;
  for (int i = 2; i <= n; ++i) {
    if (is_prime[i]) {
      plist[pcnt++] = i;
      for (int j = i << 1; j <= n; j += i) {
        is_prime[j] = false;
      }
    }
  }
}
int factorize(long long x) {
  int cnt = 0;
  for (int i = 0; i < pcnt && (long long)plist[i] * plist[i] <= x; ++i) {
    for (; x % plist[i] == 0; x /= plist[i]) ++cnt;
  }
  if (x > 1) ++cnt;
  return cnt;
}
int fa[10];
int gao() {
  long long v[10];
  int sz[10];
  vector<int> e[10];
  for (int i = 0; i < n; ++i) {
    v[i] = a[i];
    sz[i] = pc[i] > 1 ? pc[i] + 1 : 1;
  }
  int ret = 0, cnt = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (fa[i] >= 0) {
      int y = fa[i];
      if (v[y] % a[i]) return INF;
      v[y] /= a[i];
      sz[y] += sz[i] - pc[i];
    } else {
      ret += sz[i];
      ++cnt;
    }
  }
  if (cnt > 1) ++ret;
  return ret;
}
void dfs(int k) {
  if (k == n) {
    ans = min(ans, gao());
    return;
  }
  for (int i = -1; i < k; ++i) {
    fa[k] = i;
    dfs(k + 1);
  }
}
int main() {
  init_prime(N);
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%I64d", a + i);
  }
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = 0; i < n; ++i) {
    pc[i] = factorize(a[i]);
  }
  ans = INF;
  dfs(0);
  printf("%d\n", ans);
}
