#include <bits/stdc++.h>
using namespace std;
int rec(vector<long long> a, int p, vector<int> c, vector<bool> &u, int root) {
  int res = 0;
  if (p < 0) {
    for (int i = 0; i < c.size(); ++i) {
      if (!u[i]) {
        res += c[i];
      }
    }
    return res;
  }
  res = rec(a, p - 1, c, u, root + 1) + (root == 1) + 1;
  for (int i = p + 1; i < a.size(); ++i) {
    if (a[i] % a[p] == 0) {
      a[i] /= a[p];
      c[i] -= c[p];
      res = min(res, rec(a, p - 1, c, u, root) + 1);
      a[i] *= a[p];
      c[i] += c[p];
    }
  }
  return res;
}
void solve() {
  int n;
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  vector<int> c(n);
  vector<bool> u(n);
  for (int i = 0; i < a.size(); ++i) {
    long long x = a[i];
    c[i] = 0;
    int sq = sqrt(x) + 1;
    for (int j = 2; j <= sq; ++j) {
      while (x % j == 0) {
        x /= j;
        ++c[i];
      }
    }
    if (x > 1) {
      c[i]++;
    }
    if (c[i] == 1) {
      u[i] = true;
    } else {
      u[i] = false;
    }
  }
  if (a.size() == 1) {
    cout << c[0] + 1 - (c[0] == 1);
  } else {
    cout << rec(a, a.size() - 1, c, u, 0);
  }
}
int main() {
  solve();
  return 0;
}
