#include <bits/stdc++.h>
using namespace std;
long long a[10];
int n, d[10], f[10][1 << 10], g[1 << 10], h[1 << 10], ans;
int get_d(long long n) {
  int t = 0, q = sqrt(n);
  for (int i = 2; i <= q; i++) {
    while (n % i == 0) {
      n /= i;
      t++;
    }
    if (n == 1) break;
  }
  if (n > 1) t++;
  return t;
}
int check(int i, int s) {
  int t = d[i];
  long long x = a[i];
  for (int j = 1; j < i; j++)
    if (s & (1 << (j - 1))) {
      if (x % a[j]) return -1;
      x /= a[j];
      t -= d[j];
    }
  return t;
}
void upd(int &x, int y) {
  if (x == -1 || x > y) x = y;
}
void dp(int x, int s, int t) {
  int ss = (1 << (x - 1)) - 1;
  bool bo = 0;
  for (int i = 0; i <= ss; i++) g[i] = h[i] = -1;
  for (int i = 1; i < x; i++) {
    if ((s & (1 << (i - 1))) == 0) continue;
    ss = (1 << i) - 1;
    if (bo == 0) {
      bo = 1;
      for (int j = 0; j <= ss; j++) g[j] = f[i][j];
    } else {
      for (int j = 0; j <= ss; j++) g[j] = -1;
      for (int j = 1; j <= ss; j++)
        for (int k = j - 1; k; k = (k - 1) & j)
          if (h[k] != -1 && f[i][j - k] != -1) upd(g[j], h[k] + f[i][j - k]);
    }
    for (int j = 0; j <= ss; j++) h[j] = g[j];
  }
  ss = (1 << (x - 1)) - 1;
  for (int i = 0; i <= ss; i++)
    if (h[i] != -1) upd(f[x][i], h[i] + t + 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) d[i] = get_d(a[i]);
  memset(f, -1, sizeof(f));
  for (int i = 1; i <= n; i++) {
    int ss = (1 << (i - 1)) - 1;
    for (int s = 1; s <= ss; s++) {
      int t = check(i, s);
      if (t != -1) dp(i, s, t);
    }
    for (int s = 1; s <= ss; s++)
      if (f[i][s] != -1) {
        upd(f[i][s + (1 << (i - 1))], f[i][s]);
        f[i][s] = -1;
      }
    if (d[i] == 1)
      f[i][1 << (i - 1)] = d[i];
    else
      f[i][1 << (i - 1)] = d[i] + 1;
  }
  int ss = (1 << n) - 1;
  ans = f[n][ss];
  for (int s = 1; s <= ss; s++) dp(n + 1, s, 0);
  upd(ans, f[n + 1][ss]);
  printf("%d\n", ans);
  return 0;
}
