#include <bits/stdc++.h>
using namespace std;
long long a[10];
int n;
int cnt[10], sump;
vector<long long> tree;
int rec(int cur, int trees, int treessum) {
  if (cur > n) return treessum + (trees > 1) + n - sump;
  int ans = (int)1e9;
  for (int i = 0; i < tree.size(); ++i)
    if (tree[i] % a[cur] == 0) {
      tree[i] /= a[cur];
      tree.push_back(a[cur]);
      ans = min(ans, rec(cur + 1, trees + (!i), treessum + (!i) * cnt[cur]));
      tree[i] *= a[cur];
      tree.pop_back();
    }
  return ans;
}
bool cmp(long long a, long long b) { return a > b; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%I64d", a + i);
  sort(a + 1, a + 1 + n, cmp);
  for (int i = 1; i <= n; ++i) {
    long long x = a[i];
    for (int j = 2; 1ll * j * j <= x; ++j)
      while (x % j == 0) {
        ++cnt[i];
        x /= j;
      }
    if (x > 1) ++cnt[i];
    if (cnt[i] == 1) ++sump;
  }
  tree.push_back(0);
  printf("%d\n", rec(1, 0, 0));
  return 0;
}
