#include <bits/stdc++.h>
const int li[] = {-1, 0, 1, 0};
const int lj[] = {0, -1, 0, 1};
using namespace std;
const int N = 1000;
long long edge[10][N], edgenum[10], num[10], nn[10], fj[10][N];
long long arr[10];
int cnt;
void makeprime(long long n, int id) {
  num[id] = 0;
  long long mod = n;
  double q = n;
  for (int i = 2; i <= (long long)(sqrt(q)) && n != 1; ++i) {
    while (n % i == 0) {
      num[id]++;
      n /= i;
    }
  }
  if (n != 1 && n < mod) num[id] += 1;
}
int n;
bool vis[10];
void INIT() {
  memset(vis, 0, sizeof(vis));
  memset(edgenum, 0, sizeof(edgenum));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j)
      if (i != j) {
        if (arr[j] % arr[i] == 0) edge[i][edgenum[i]++] = j, vis[j] = true;
      }
  }
}
int ans;
bool flag[10];
int minn;
int every[10][10];
void dfs(long long t, long long cnt, long long tot, int k) {
  if (t == cnt) {
    if (k > 1) tot++;
    minn = minn < tot ? minn : tot;
    return;
  }
  if (minn <= tot) return;
  int id;
  for (int tt = 0; tt < n; ++tt) {
    if (!flag[tt]) {
      id = tt;
      flag[tt] = true;
      int tttt = 1;
      for (int i = 0; i < edgenum[id]; ++i) {
        if (flag[edge[id][i]]) continue;
        long long it = 1;
        for (int j = 0; j < n; ++j)
          if (every[edge[id][i]][j]) {
            it *= arr[j];
          }
        if (it > 10000000 && arr[id] > 10000000) continue;
        it *= arr[id];
        if (arr[edge[id][i]] % it) {
          continue;
        }
        tttt = 0;
        every[edge[id][i]][id] = true;
        nn[edge[id][i]] -= (num[id]);
        dfs(t + 1, cnt, tot + nn[id], k);
        every[edge[id][i]][id] = false;
        nn[edge[id][i]] += (num[id]);
      }
      if (tttt) {
        int nnn = 0;
        if (!num[id]) nnn++;
        dfs(t + 1, cnt, tot + nn[id] + nnn, k + 1);
      }
      flag[tt] = false;
    }
  }
}
void DO() {
  memset(flag, 0, sizeof(flag));
  memset(every, 0, sizeof(every));
  minn = 1 << 29;
  for (int i = 0; i < 10; ++i) nn[i] = num[i];
  dfs(0, n, 0, 0);
}
bool cmp(int a, int b) { return a > b; }
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; ++i) {
      scanf("%lld", &arr[i]);
    }
    for (int i = 0; i < n; ++i) {
      makeprime(arr[i], i);
    }
    INIT();
    DO();
    for (int i = 0; i < n; ++i)
      if (num[i]) minn++;
    printf("%d\n", minn);
  }
  return 0;
}
