#include <bits/stdc++.h>
using namespace std;
int ma[10][10];
long long a[10];
long long val[10];
int work(long long n) {
  int x = sqrt(n);
  int ret = 0;
  for (int i = 2; i <= x; i++) {
    while (n % i == 0) {
      n /= i;
      ret++;
    }
  }
  if (n > 1) ret++;
  return ret;
}
int ans = 0;
int mn;
int tmp[10];
map<long long, bool> maa;
long long getkey(long long a[]) {
  for (int i = 0; i < mn; i++) tmp[i] = a[i];
  sort(tmp, tmp + mn);
  long long ret = 0;
  for (int i = 0; i < mn; i++) ret = ret * 11 * 19 + tmp[i];
  return ret;
}
int vis[100][100];
int vv[100];
void dfs(int v, int kx) {
  int flag = 0;
  long long k = getkey(a);
  if (maa.find(k) != maa.end()) return;
  maa[k] = 1;
  for (int i = 0; i < mn; i++)
    for (int j = 0; j < mn; j++)
      if (i != j && a[i] % a[j] == 0 && !vis[i][j] && !vv[j]) {
        bool b = vv[i];
        vv[i] = 1;
        vis[i][j] = 1;
        flag = 1;
        a[i] /= a[j];
        vv[j] = 1;
        dfs(v + val[j], kx + 1);
        vis[i][j] = 0;
        vv[j] = 0;
        vv[i] = b;
        a[i] *= a[j];
      }
  if (flag == 0) ans = max(ans, v + (kx == mn - 1));
}
int main() {
  int n;
  cin >> n;
  mn = n;
  int maxn = 0;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) val[i] = work(a[i]);
  for (int i = 0; i < n; i++) maxn += val[i];
  for (int i = 0; i < n; i++) tmp[i] = a[i];
  maxn += n + 1;
  for (int i = 0; i < n; i++)
    if (val[i] == 1) maxn--;
  dfs(0, 0);
  cout << maxn - ans << endl;
}
