#include <bits/stdc++.h>
using namespace std;
int n;
vector<pair<long long, int> > v;
int dp[8][1 << 8][3];
int calc(int i, int mask, int roots) {
  roots = min(roots, 2);
  if (i == n) return roots != 1;
  int &ret = dp[i][mask][roots];
  if (ret != -1) return ret;
  ret = 1e9;
  for (int take = mask; take >= 0; take = (take - 1) & mask) {
    int cur = take | (1 << i);
    bool can = true;
    long long num = v[i].first;
    int cost = v[i].second;
    if (cost != 1) ++cost;
    for (int j = i + 1; j < n; ++j)
      if (((cur >> j) & 1)) {
        if (num % v[j].first) {
          can = false;
          break;
        }
        num /= v[j].first;
        cost -= v[j].second;
      }
    if (can)
      ret = min(ret, cost + calc(i + 1, (mask ^ take) & ~(1 << i),
                                 roots + ((mask >> i) & 1)));
    if (take == 0) break;
  }
  return ret;
}
int main() {
  cin >> n;
  v.resize(n);
  for (auto &x : v) {
    cin >> x.first;
    long long n = x.first;
    for (long long i = 2; i * i <= n; ++i) {
      while (n % i == 0) {
        ++x.second;
        n /= i;
      }
    }
    if (n != 1) ++x.second;
  }
  sort(v.begin(), v.end());
  reverse(v.begin(), v.end());
  memset(dp, -1, sizeof(dp));
  int res = calc(0, (1 << n) - 1, 0);
  printf("%d\n", res);
  return 0;
}
