#include <bits/stdc++.h>
using namespace std;
const int inf = 987654321;
const long long int INF = 123456789987654321;
const int MN = 1000002;
vector<int> P, chk;
void get_P() {
  chk = vector<int>(MN, 0);
  for (int i = 2; i < MN; i++) {
    if (chk[i]) continue;
    P.push_back(i);
    int mul = 2;
    while (i * mul < MN) {
      chk[i * mul] = 1;
      mul++;
    }
  }
}
int N;
vector<long long int> arr, remain;
vector<int> par, pcnt;
void get_pcnt() {
  pcnt.clear();
  pcnt = vector<int>(N, 0);
  for (int i = 0; i < N; i++) {
    long long int t = arr[i];
    for (int j = 0; j < P.size(); j++) {
      while (t % P[j] == 0) {
        pcnt[i]++;
        t /= P[j];
      }
    }
    if (t != 1) pcnt[i]++;
  }
}
int mini = inf;
void dfs(int now) {
  if (now == N) {
    int cnt = 0, add = 0;
    for (int i = 0; i < N; i++)
      if (par[i] == -1) {
        cnt++;
        add += pcnt[i];
      }
    if (cnt > 1) add++;
    for (int i = 0; i < N; i++)
      if (pcnt[i] == 1) add--;
    mini = min(mini, N + add);
    return;
  }
  for (int i = 0; i < N; i++) {
    if (i == now) continue;
    if (remain[i] % arr[now] == 0) {
      remain[i] /= arr[now];
      par[now] = i;
      dfs(now + 1);
      remain[i] *= arr[now];
    }
  }
  par[now] = -1;
  dfs(now + 1);
}
int main() {
  get_P();
  scanf("%d", &N);
  arr.resize(N);
  remain.resize(N);
  for (int i = 0; i < N; i++) {
    scanf("%I64d", &arr[i]);
    remain[i] = arr[i];
  }
  get_pcnt();
  par = vector<int>(N, -1);
  dfs(0);
  printf("%d", mini);
}
