#include <bits/stdc++.h>
using namespace std;
int minsumdiv = 1000000000;
vector<long long int> vec;
vector<int> papa;
vector<int> numdiv;
void process() {
  const int n = papa.size();
  vector<long long int> tmpvec = vec;
  vector<int> tmpdiv = numdiv;
  int m1cnt = 0;
  for (int i = n - 1; i >= 0; i--) {
    int j = papa[i];
    if (j == -1) {
      m1cnt++;
      continue;
    }
    if (tmpvec[j] % tmpvec[i] != 0) return;
    tmpvec[j] /= tmpvec[i];
    tmpdiv[j] -= numdiv[i];
  }
  int sumdiv = 0;
  for (int i = 0; i < n; i++) {
    if (tmpdiv[i] == 1 && vec[i] == tmpvec[i]) continue;
    sumdiv += tmpdiv[i];
  }
  sumdiv += n;
  if (m1cnt > 1) {
    sumdiv++;
  }
  minsumdiv = min(minsumdiv, sumdiv);
}
void generate(int ind) {
  if (ind == papa.size()) {
    process();
    return;
  }
  for (int i = ind; i < papa.size(); i++) {
    papa[ind] = i == ind ? -1 : i;
    if (papa[ind] != -1 && vec[papa[ind]] % vec[ind] != 0) continue;
    generate(ind + 1);
  }
}
int main() {
  int n;
  cin >> n;
  vec.resize(n);
  papa.resize(n);
  numdiv.resize(n);
  for (int i = 0; i < n; i++) cin >> vec[i];
  sort(vec.begin(), vec.end());
  for (int i = 0; i < n; i++) {
    long long int x = vec[i];
    int divs = 0;
    while (x % 2 == 0) {
      divs++;
      x /= 2;
    }
    for (long long int y = 3; y * y <= x; y += 2) {
      while (x % y == 0) {
        x /= y;
        divs++;
      }
    }
    if (x > 1) divs++;
    numdiv[i] = divs;
  }
  generate(0);
  cout << minsumdiv;
  return 0;
}
