#include <bits/stdc++.h>
using namespace std;
int n, primes, final, cnt[11];
long long num[11], nn[11];
void Init() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%I64d", &num[i]);
}
bool cmp(long long a, long long b) { return a > b; }
void prepare() {
  for (int i = 1; i <= n; i++) {
    long long x = num[i];
    for (long long j = 2; j * j <= x; j++)
      while (x % j == 0) {
        x /= j;
        cnt[i]++;
      }
    if (x > 1) cnt[i]++;
    if (cnt[i] == 1) cnt[i] = 0;
  }
}
void dfs(int mystep, int best, bool ok) {
  for (int i = 0; i <= mystep - 1; i++)
    if ((i == 0) || (nn[i] % num[mystep] == 0)) {
      int noww = best + 1;
      if (i == 0) noww += cnt[mystep];
      if (cnt[mystep] == 0 && i != 0) noww--;
      bool ok2 = ok;
      if (mystep > 1 && i == 0) ok2 = 1;
      nn[i] /= num[mystep];
      if (mystep < n)
        dfs(mystep + 1, noww, ok2);
      else {
        if (ok2)
          final = min(final, noww);
        else
          final = min(final, noww - 1);
      }
      nn[i] *= num[mystep];
    }
}
void solve() {
  sort(num + 1, num + n + 1, cmp);
  for (int i = 1; i <= n; i++) nn[i] = num[i];
  prepare();
  final = 0x7fffffff;
  dfs(1, 1, 0);
  printf("%d\n", final);
}
int main() {
  Init();
  solve();
  return 0;
}
