#include <bits/stdc++.h>
using namespace std;
long long int a[20], n, primecount, primes[20];
vector<long long int> tree;
long long int comp(long long int curr, long long int rootChildrenNum,
                   long long int totalBranchCount) {
  if (curr == n)
    return rootChildrenNum + (totalBranchCount > 1) + n - primecount;
  long long int i, j, t1, t2, t3, t4, temp = 1e8;
  for (i = 0; i < tree.size(); i++) {
    if (tree[i] % a[curr] == 0) {
      tree[i] /= a[curr];
      tree.push_back(a[curr]);
      temp = min(temp,
                 comp(curr + 1, rootChildrenNum + ((i == 0) ? primes[curr] : 0),
                      totalBranchCount + (i == 0)));
      tree.pop_back();
      tree[i] *= a[curr];
    }
  }
  return temp;
}
int main() {
  long long int i, j, t1, t2, t3, t4, ans;
  scanf("%lld", &n);
  for (i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    primes[i] = 0;
  }
  primecount = 0;
  sort(a, a + n);
  reverse(a, a + n);
  for (i = 0; i < n; i++) {
    t1 = a[i];
    for (j = 2; j * j <= t1; j++) {
      while (t1 % j == 0) {
        primes[i]++;
        t1 /= j;
      }
    }
    if (t1 > 1) primes[i]++;
    if (primes[i] == 1) primecount++;
  }
  tree.push_back(0);
  ans = comp(0, 0, 0);
  printf("%lld\n", ans);
  return 0;
}
