#include <bits/stdc++.h>
using namespace std;
const size_t MAX_N = 10;
unordered_map<long long, int> mp;
int n, res = INT_MAX;
bool not_prime[(size_t)1e6 + 5];
vector<long long> primes;
set<int> edge[MAX_N];
long long a[MAX_N], cval[MAX_N];
inline void init() {
  for (int i = 2; i <= 1e6; i++)
    if (!not_prime[i])
      for (int j = i << 1; j <= 1e6; j += i) not_prime[j] = true;
  for (int i = 2; i <= 1e6; i++)
    if (!not_prime[i]) primes.emplace_back(i);
}
inline int counting(long long x) {
  if (mp.count(x)) return mp[x];
  long long t = x;
  int cnt = 0;
  for (long long p : primes) {
    if (p > x) break;
    for (; x % p == 0; cnt++) x /= p;
  }
  cnt += (x > 1);
  return mp[t] = cnt;
}
inline void check() {
  if (!edge[0].size()) return;
  int cnt = (edge[0].size() > 1);
  for (int i = 1; i <= n; i++)
    cnt += counting(cval[i]) + (counting(cval[i]) > 1 || a[i] != cval[i]);
  if (cnt < res) res = cnt;
}
void dfs(int cur) {
  if (cur == n + 1) return check();
  for (int i = 1; i <= n; i++)
    if (i != cur && cval[i] % a[cur] == 0) {
      cval[i] /= a[cur];
      dfs(cur + 1);
      cval[i] *= a[cur];
    }
  edge[0].emplace(cur);
  dfs(cur + 1);
  edge[0].erase(cur);
}
int main() {
  mp.reserve(512);
  mp.max_load_factor(0.25f);
  ios::sync_with_stdio(false);
  init();
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    cval[i] = a[i];
  }
  dfs(1);
  cout << res;
}
