#include <bits/stdc++.h>
using namespace std;
const double eps(1e-8);
const int inf = 1e9 + 7;
int n;
long long a[10];
int divisors[10];
vector<long long> tree;
int prime_cnt;
int dfs(int now, int ai_with_roots, int divisors_cnt) {
  if (now == 0) return n + (ai_with_roots > 1) + divisors_cnt - prime_cnt;
  int ret = inf;
  for (unsigned int i = 0; i < tree.size(); i++) {
    if (tree[i] % a[now] == 0) {
      tree[i] /= a[now];
      tree.push_back(a[now]);
      ret = min(ret, dfs(now - 1, ai_with_roots + (i == 0),
                         divisors_cnt + (i == 0 ? divisors[now] : 0)));
      tree[i] *= a[now];
      tree.pop_back();
    }
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%I64d", a + i);
  sort(a + 1, a + n + 1);
  for (int i = n; i > 0; i--) {
    long long ta = a[i];
    for (long long j = 2; j * j <= ta; j++) {
      while (ta % j == 0) {
        ta /= j;
        divisors[i]++;
      }
    }
    if (ta > 1) divisors[i]++;
    if (divisors[i] == 1) prime_cnt++;
  }
  tree.push_back(0);
  printf("%d\n", dfs(n, 0, 0));
  return 0;
}
