#include <bits/stdc++.h>
using namespace std;
int n, i, j, s[10], to[10], ans;
long long x, a[10], b[10];
bool cmp(long long x, long long y) { return x > y; }
void dfs(int k) {
  if (k > n) {
    memcpy(b, a, sizeof(a));
    int sum = 0, tt = 0;
    for (int i = 1; i <= n; i++) {
      if (b[to[i]] % b[i] != 0) return;
      b[to[i]] /= b[i];
      if (!to[i]) sum += s[i], tt++;
      if (s[i] > 1) sum++;
    }
    if (tt > 1) sum++;
    ans = min(ans, sum);
  } else
    for (int i = 0; i < k; i++) to[k] = i, dfs(k + 1);
}
int main() {
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  sort(a + 1, a + n + 1, cmp);
  for (i = 1; i <= n; i++) {
    for (x = a[i], j = 2; 1LL * j * j <= x; j++)
      while (x % j == 0) x /= j, s[i]++;
    if (x > 1) s[i]++;
  }
  ans = 100000000;
  dfs(1);
  printf("%d\n", ans);
}
