#include <bits/stdc++.h>
using namespace std;
const int NMAX = 8;
const int MMAX = 1000000;
const int PNUM = 78498;
int isp[1 + MMAX];
int plst[PNUM];
int ANS;
int N;
long long A[NMAX], B[NMAX];
int C[NMAX], P[NMAX];
bool IsPrime(long long x) {
  if (x <= 1) return false;
  if (x <= MMAX) return isp[x] == x;
  for (int i = 0; i < PNUM; i++) {
    const int p = plst[i];
    if (x / p < p) break;
    if (x % p == 0) return false;
  }
  return true;
}
int f(long long x) {
  int ret = 0;
  for (int i = 0; i < PNUM && x > MMAX; i++) {
    const int p = plst[i];
    if (x / p < p) break;
    while (x % p == 0) {
      x /= p;
      ret++;
    }
  }
  if (x != 1) {
    if (x <= MMAX) {
      while (x != 1) {
        ret++;
        x /= isp[x];
      }
    } else {
      ret++;
    }
  }
  return ret;
}
void test() {
  int tmp = 0;
  for (int i = 0; i < N; i++)
    if (P[i] < 0) tmp++;
  tmp = (tmp >= 2 ? 1 : 0);
  for (int i = 0; i < N; i++) {
    tmp++;
    if (C[i] == 0) {
      if (!IsPrime(B[i])) tmp += f(B[i]);
    } else {
      if (B[i] != 1) tmp += f(B[i]);
    }
  }
  if (tmp < ANS) ANS = tmp;
}
void dfs(int dep) {
  if (dep == N) {
    test();
    return;
  }
  for (int i = 0; i < dep; i++) {
    if (B[i] % A[dep] != 0) continue;
    B[i] /= A[dep];
    P[dep] = i;
    C[i]++;
    dfs(dep + 1);
    C[i]--;
    B[i] *= A[dep];
  }
  P[dep] = -1;
  dfs(dep + 1);
}
int solve() {
  sort(A, A + N);
  reverse(A, A + N);
  copy(A, A + N, B);
  ANS = INT_MAX;
  dfs(0);
  return ANS;
}
void input() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> A[i];
}
void build() {
  int i, j, k = 0;
  for (i = 2; i <= MMAX; i++) {
    if (isp[i] != 0) continue;
    plst[k++] = i;
    isp[i] = i;
    for (j = i; (j += i) <= MMAX;) isp[j] = i;
  }
}
int main() {
  build();
  input();
  cout << solve() << endl;
  return 0;
}
