#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long n, a[10], is[1000006], ans = 1e9;
vector<pair<long long, pair<long long, long long> > > v;
vector<long long> prm;
map<long long, int> mp;
int pf(long long x) {
  long long ad = 0;
  for (int j = 0; j < prm.size(); j++) {
    if (x == 1) break;
    while (x % prm[j] == 0) {
      x /= prm[j];
      ad++;
    }
  }
  if (x != 1) ad++;
  return ad;
}
void f(long long x) {
  long long anss = 0;
  for (int i = 0; i < v.size(); i++) {
    long long ad = mp[v[i].first];
    if (ad == 1) ad = 0;
    anss += ad + 1;
  }
  if (v.size() > 1)
    ans = min(ans, anss + x + 1);
  else
    ans = min(ans, anss + x);
  for (int i = 0; i < v.size(); i++) {
    for (int j = 0; j < v.size(); j++) {
      if (i == j) continue;
      pair<long long, pair<long long, long long> > vi = v[i];
      pair<long long, pair<long long, long long> > vj = v[j];
      if (v[j].second.first % v[i].first == 0) {
        if (j > i) {
          v.push_back({v[j].first,
                       {v[j].second.first / v[i].first, v[j].second.second}});
          v.erase(v.begin() + j);
          v.erase(v.begin() + i);
          if (vi.second.second == 1)
            f(x);
          else
            f(x + 1);
          v.insert(v.begin() + i, vi);
          v.insert(v.begin() + j, vj);
          v.pop_back();
        } else {
          v.push_back({v[j].first,
                       {v[j].second.first / v[i].first, v[j].second.second}});
          v.erase(v.begin() + i);
          v.erase(v.begin() + j);
          if (vi.second.second == 1)
            f(x);
          else
            f(x + 1);
          v.insert(v.begin() + j, vj);
          v.insert(v.begin() + i, vi);
          v.pop_back();
        }
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  for (int i = 2; i <= 1e6; i++) {
    if (is[i]) continue;
    prm.push_back(i);
    for (int j = i; j <= 1e6; j += i) is[j] = 1;
  }
  scanf("%lld", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    mp[a[i]] = pf(a[i]);
    v.push_back({a[i], {a[i], mp[a[i]]}});
  }
  f(0);
  printf("%lld", ans);
}
