#include <bits/stdc++.h>
using namespace std;
void _fill_int(int* p, int val, int rep) {
  int i;
  for (i = 0; i < rep; i++) p[i] = val;
}
void _fill_ll(signed long long* p, signed long long val, int rep) {
  int i;
  for (i = 0; i < rep; i++) p[i] = val;
}
signed long long GETi() {
  signed long long i;
  scanf("%lld", &i);
  return i;
}
int N;
signed long long A[10], B[10];
int pr[10];
int tar[10];
int NP, prime[100000];
const int prime_max = 1000000;
void cprime() {
  static int p[prime_max];
  int i, j;
  for (i = 2; i < prime_max; i++) {
    if (p[i]) continue;
    prime[NP++] = i;
    for (j = i * 2; j < prime_max; j += i) p[j] = i;
  }
}
int calc() {
  int i, x, nt = 0, r = N;
  for (i = 0; i < N; i++)
    if (tar[i] == i) nt++;
  if (nt > 1) r++;
  for (i = 0; i < N; i++) {
    if (B[i] == 1) continue;
    signed long long xx = B[i];
    for (x = 0; x < NP; x++) {
      if (xx < prime[x]) break;
      while (xx % prime[x] == 0) r++, xx /= prime[x];
    }
    if (xx > 1) r++;
    if (A[i] == B[i] && pr[i] == 1) r--;
  }
  return r;
}
int dfs(int cur) {
  signed long long t;
  if (cur == N) return calc();
  tar[cur] = cur;
  int r = dfs(cur + 1);
  for (tar[cur] = cur + 1; tar[cur] < N; tar[cur]++) {
    if (B[tar[cur]] % A[cur] == 0) {
      B[tar[cur]] /= A[cur];
      r = min(r, dfs(cur + 1));
      B[tar[cur]] *= A[cur];
    }
  }
  return r;
}
void solve() {
  int f, i, j, k, l, x, y;
  signed long long ret = 0;
  cprime();
  cin >> N;
  for (i = 0; i < N; i++) cin >> A[i];
  sort(A, A + N);
  for (i = 0; i < N; i++) {
    signed long long xx = B[i] = A[i];
    for (x = 0; x < NP; x++)
      while (xx % prime[x] == 0) pr[i]++, xx /= prime[x];
    if (xx > 1) pr[i]++;
  }
  (void)printf("%d\n", dfs(0));
}
int main(int argc, char** argv) {
  if (argc > 1) freopen(argv[1], "r", stdin);
  solve();
  return 0;
}
