#include <bits/stdc++.h>
int compare(const void *a, const void *b) {
  long long la = *(long long *)a;
  long long lb = *(long long *)b;
  return la == lb ? 0 : la < lb ? -1 : 1;
}
long long aa[8], aa_[8];
int bb[8], dp[8][1 << (8 - 1)];
char pp[8];
int n, ans = 0x3f3f3f3f;
void solve(int i) {
  int j;
  if (i == n) {
    int cnt, sum;
    cnt = 0, sum = 0;
    for (i = 0; i < n; i++) {
      int k;
      if (!pp[i]) cnt++;
      k = dp[i][bb[i]];
      sum += k == 1 && bb[i] == 0 ? 1 : k + 1;
    }
    if (cnt >= 2) sum++;
    if (ans > sum) ans = sum;
    return;
  }
  solve(i + 1);
  pp[i] = 1;
  for (j = i + 1; j < n; j++)
    if (aa_[j] % aa[i] == 0) {
      aa_[j] /= aa[i], bb[j] ^= 1 << i;
      solve(i + 1);
      aa_[j] *= aa[i], bb[j] ^= 1 << i;
    }
  pp[i] = 0;
}
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 0; i < n; i++) scanf("%lld", &aa[i]);
  qsort(aa, n, sizeof *aa, compare);
  for (i = 0; i < n; i++) {
    long long a;
    int k, p, b;
    a = aa[i];
    k = 0;
    for (p = 2; p <= a / p; p++)
      while (a % p == 0) {
        k++;
        a /= p;
      }
    if (a > 1) k++;
    dp[i][0] = k;
    for (b = 1; b < 1 << i; b++) {
      a = aa[i];
      k = dp[i][0];
      for (j = 0; j < i; j++)
        if ((b & 1 << j)) {
          if (a % aa[j] != 0) {
            k = -1;
            break;
          }
          a /= aa[j];
          k -= dp[j][0];
        }
      dp[i][b] = k;
    }
  }
  for (i = 0; i < n; i++) aa_[i] = aa[i];
  solve(0);
  printf("%d\n", ans);
  return 0;
}
