#include <bits/stdc++.h>
using namespace std;
void io_in_data() {
  freopen("data.in", "r", stdin);
  freopen("data1.out", "w", stdout);
}
const int MAXN = 9;
long long a[MAXN];
int p[MAXN], ans, n;
void getp(int n) {
  for (int i = 1; i <= n; i++) {
    p[i] = 0;
    long long t = a[i];
    for (long long j = 2; j * j <= t; j++)
      while (t % j == 0) t /= j, p[i]++;
    if (t != 1) p[i]++;
  }
}
void dfs(int pz, int sum, int flg) {
  if (pz == 0) {
    ans = min(ans, sum + n + (flg > 0));
    return;
  }
  for (int i = n; i > pz; i--)
    if (a[i] % a[pz] == 0) {
      a[i] /= a[pz];
      dfs(pz - 1, sum, flg);
      a[i] *= a[pz];
    }
  dfs(pz - 1, sum + p[pz], flg + 1);
}
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 1; i <= n; i++) cin >> a[i];
    sort(a + 1, a + 1 + n);
    getp(n);
    int cnt = 0;
    for (int i = 1; i <= n; i++)
      if (p[i] == 1) cnt++;
    ans = INT_MAX;
    dfs(n - 1, 0, 0);
    printf("%d\n", ans + p[n] - cnt);
  }
  return 0;
}
