#include <bits/stdc++.h>
using namespace std;
const int N = 10;
long long a[N], b[N], c[N], d[N], f[N], ans;
int n;
void dfs(int x) {
  if (x == n) {
    long long num = (d[n] == 1) ? 0 : 1;
    for (int i = 0; i < n; i++) {
      if (f[i] == n) num += b[i];
      if (b[i] > 1) num++;
    }
    ans = min(ans, num);
    return;
  }
  for (int i = x + 1; i < n; i++)
    if (c[i] % a[x] == 0) {
      c[i] /= a[x];
      f[x] = i;
      dfs(x + 1);
      c[i] *= a[x];
    }
  f[x] = n;
  d[n]++;
  dfs(x + 1);
  d[n]--;
}
int main() {
  while (cin >> n) {
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    memset(b, 0, sizeof(b));
    memset(c, 0, sizeof(c));
    memset(d, 0, sizeof(d));
    memset(f, -1, sizeof(f));
    for (int i = 0; i < n; i++) {
      long long x = a[i];
      c[i] = a[i];
      for (long long j = 2; j * j <= x; j++) {
        while (x % j == 0) x /= j, b[i]++;
      }
      if (x > 1) b[i]++;
      ans += b[i];
    }
    ans += n + 1;
    dfs(0);
    cout << ans << endl;
  }
  return 0;
}
