#include <bits/stdc++.h>
using namespace std;
long long a[10];
int ans = 0x3f3f3f3f;
long long temp[10];
bool isprime[10];
int num[10], tnum[10];
int n;
int calnum(long long x) {
  long long i;
  int res = 0;
  for (i = 2; i * i <= x; ++i)
    while (x % i == 0) {
      x /= i;
      res++;
    }
  if (x != 1) res++;
  return res;
}
void dfs(int cur, int cnt, int last) {
  if (cnt >= ans) return;
  if (cur >= n) {
    if (last >= 2) cnt++;
    ans = min(ans, cnt);
    return;
  }
  for (int i = cur + 1; i < n; ++i)
    if (temp[i] % a[cur] == 0) {
      temp[i] /= a[cur];
      tnum[i] -= num[cur];
      dfs(cur + 1, cnt + tnum[cur] + (!isprime[cur]), last);
      temp[i] *= a[cur];
      tnum[i] += num[cur];
    }
  dfs(cur + 1, cnt + tnum[cur] + (!isprime[cur]), last + 1);
}
int main() {
  scanf("%d", &n);
  int i;
  for (i = 0; i < n; ++i) scanf("%I64d", a + i);
  sort(a, a + n);
  memset(isprime, 0, sizeof(isprime));
  for (i = 0; i < n; ++i) {
    num[i] = calnum(a[i]);
    tnum[i] = num[i];
    temp[i] = a[i];
    if (num[i] == 1) isprime[i] = 1;
  }
  dfs(0, 0, 0);
  printf("%d\n", ans);
  return 0;
}
