#include <bits/stdc++.h>
using namespace std;
int primeCount[10];
int isPrime;
long long min(long long a, long long b) { return a < b ? a : b; }
long long dfs(int cur, vector<long long>& tree, vector<long long>& vec,
              int childrenSum, int isRootChildren) {
  long long best = 1e9;
  if (cur == vec.size()) {
    return childrenSum + (isRootChildren > 1) + vec.size() - isPrime;
  }
  for (int i = 0; i < tree.size(); i++) {
    if (tree[i] % vec[cur] == 0) {
      tree[i] /= vec[cur];
      tree.push_back(vec[cur]);
      best = min(best, dfs(cur + 1, tree, vec,
                           childrenSum + (i == 0 ? primeCount[cur] : 0),
                           isRootChildren + (i == 0 ? +1 : 0)));
      tree.pop_back();
      tree[i] *= vec[cur];
    }
  }
  return best;
}
int main() {
  int n;
  while (cin >> n) {
    memset(primeCount, 0, sizeof(primeCount));
    isPrime = 0;
    vector<long long> vec;
    for (int i = 0; i < n; i++) {
      long long k;
      cin >> k;
      vec.push_back(k);
    }
    sort(vec.begin(), vec.end());
    reverse(vec.begin(), vec.end());
    for (int i = 0; i < vec.size(); i++) {
      long long x = vec[i];
      for (long long j = 2; j * j <= x; j++) {
        while (x % j == 0) {
          primeCount[i]++;
          x /= j;
        }
      }
      if (x > 1) {
        primeCount[i]++;
      }
      if (primeCount[i] == 1) {
        isPrime++;
      }
    }
    vector<long long> tree;
    tree.push_back(0);
    cout << dfs(0, tree, vec, 0, 0) << endl;
  }
  return 0;
}
