#include <bits/stdc++.h>
using namespace std;
const long long N = 10;
long long n, ans = INT_MAX, a[N], w[N], par[N];
bool isPrime[N];
vector<long long> child[N];
long long f(long long x) {
  long long i, rez = 0;
  for (i = 2; i * i <= x; ++i)
    while (x % i == 0) {
      ++rez;
      x /= i;
    }
  if (x != 1) ++rez;
  return rez;
}
bool g(long long x) {
  long long i;
  if (x == 1) return 0;
  for (i = 2; i * i <= x; ++i)
    if (x % i == 0) return 0;
  return 1;
}
void rec(long long x) {
  long long i, tmp, rez = n;
  if (x == n) {
    for (i = 0; i < n; ++i) {
      tmp = a[i];
      if (par[i] == n) rez += w[i];
      for (auto u : child[i]) {
        if (tmp % a[u] == 0)
          tmp /= a[u];
        else
          return;
      }
      if (isPrime[i]) rez--;
    }
    if (child[n].size() > 1) rez++;
    ans = min(ans, rez);
  }
  for (i = x + 1; i <= n; ++i) {
    par[x] = i;
    child[i].push_back(x);
    rec(x + 1);
    child[i].pop_back();
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long i;
  cin >> n;
  for (i = 0; i < n; ++i) cin >> a[i];
  sort(a, a + n);
  for (i = 0; i < n; ++i) {
    w[i] = f(a[i]);
    isPrime[i] = g(a[i]);
  }
  rec(0);
  cout << ans << '\n';
  return 0;
}
