#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
long long arr[N], prime[N], p;
long long brr[10];
int n;
map<long long, long long> mm;
void sieve() {
  double z = sqrt(N);
  for (int i = 3; i <= z; i += 2) {
    if (arr[i] == 0)
      for (long long j = i * i; j < N; j += i + i) arr[j] = 1;
  }
  prime[p++] = 2;
  for (int i = 3; i < N; i += 2)
    if (!arr[i]) prime[p++] = i;
}
long long calcu(long long xx) {
  long long res = 0;
  long long bal = xx;
  if (mm.find(xx) != mm.end()) return mm[xx];
  for (int i = 0; i < p && prime[i] * 1ll * prime[i] * 1ll <= xx; i++) {
    while (xx % prime[i] == 0) {
      xx /= prime[i];
      res++;
    }
  }
  if (xx > 1) res++;
  return mm[bal] = res;
}
long long giveres(int mask, vector<long long> s) {
  if (mask == (1 << n) - 1) {
    if ((int)s.size() > 1)
      return 1;
    else
      return 0;
  }
  long long res = 1e9;
  vector<long long> ss = s;
  sort(ss.begin(), ss.end());
  for (int i = 0; i < n; i++) {
    if (mask & (1 << i)) continue;
    long long ans = 0;
    s = ss;
    vector<long long> temp;
    long long xx = brr[i];
    for (auto it : s) {
      if (xx % it == 0) {
        xx /= it;
        temp.push_back(it);
      }
    }
    long long yy = calcu(xx);
    ans += yy;
    if (yy > 1 || xx != brr[i]) ans++;
    for (auto it : temp) s.erase(lower_bound(s.begin(), s.end(), it));
    s.push_back(brr[i]);
    ans += giveres(mask | (1 << i), s);
    res = min(res, ans);
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  sieve();
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> brr[i];
  }
  vector<long long> ss;
  long long ans = giveres(0, ss);
  cout << ans << '\n';
  return 0;
}
