#include <bits/stdc++.h>
using namespace std;
const bool debug = false;
int n, f[15], best, ans = 0;
long long a[15];
bool avail[15];
int factorize(long long x) {
  int res = 0;
  for (int i = 2; i <= (int)sqrt(x); i++) {
    while (x % i == 0) {
      x /= i;
      res++;
    }
  }
  if (x > 1) {
    return res + 1;
  }
  return res;
}
void dfs(int x, int y) {
  if (x == n) {
    ans = min(ans, best);
    bool flag = false;
    for (int i = 1; i < n; i++) {
      flag |= avail[i];
    }
    if (!flag) {
      printf("%d\n", ans + n);
      exit(0);
    }
    return;
  }
  for (int i = y + 1; i < n; i++) {
    if (avail[i] && (a[x] % a[i] == 0)) {
      avail[i] = false;
      if ((f[i] == 0)) {
        best--;
      } else {
        best -= f[i];
      }
      a[x] /= a[i];
      dfs(x, i);
      a[x] *= a[i];
      avail[i] = true;
      if ((f[i] == 0)) {
        best++;
      } else {
        best += f[i];
      }
    }
  }
  dfs(x + 1, x + 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%I64d", &a[i]);
  }
  sort(a, a + n, greater<long long>());
  for (int i = 0; i < n; i++) {
    f[i] = factorize(a[i]);
    if (f[i] == 1) {
      f[i] = 0;
    }
    ans += f[i];
  }
  if (debug) {
    printf("n = %d, ans = %d\na[] =", n, ans);
    for (int i = 0; i < n; i++) {
      printf(" %I64d", a[i]);
    }
    printf("\nf[] =");
    for (int i = 0; i < n; i++) {
      printf(" %d", f[i]);
    }
    printf("\n\n");
  }
  memset(avail, true, sizeof(avail));
  best = ans;
  dfs(0, 0);
  printf("%d\n", ans + n + 1);
  return 0;
}
