#include <bits/stdc++.h>
using namespace std;
int n;
const int maxn = 1000000;
long long a[10];
long long b[10];
int bel[10];
bool is_fact[10][10];
bool is_prime[10];
int fact[10];
int work(long long val) {
  int cnt = 0;
  for (int i = 2; i <= maxn; i++) {
    while (val % i == 0) {
      val /= i;
      cnt++;
    }
  }
  if (val > 1) cnt++;
  return cnt;
}
bool dfs() {
  bel[0]++;
  for (int i = 0; i < n; i++) {
    if (bel[i] >= n) {
      bel[i + 1]++;
      bel[i] = i;
    }
  }
  if (bel[n] > 0) return 0;
  return 1;
}
bool prime(long long n) {
  for (long long i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return n != 1;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%I64d", &a[i]);
  sort(a, a + n);
  n = unique(a, a + n) - a;
  for (int i = 0; i < n; i++) {
    if (prime(a[i])) is_prime[i] = 1;
  }
  for (int i = 0; i < n; i++) {
    fact[i] = work(a[i]);
  }
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      if (a[j] % a[i] == 0) is_fact[i][j] = 1;
    }
  long long tmp = 0x3f3f3f3f;
  long long mii = tmp * tmp;
  long long ans = 0;
  bool ok = 1;
  for (int i = 0; i < n; i++) bel[i] = i;
  while (ok) {
    for (int i = 0; i < n; i++) b[i] = a[i];
    bool yes = 1;
    for (int i = 0; i < n; i++) {
      if (bel[i] == i) continue;
      if (b[bel[i]] < a[i]) {
        yes = 0;
        break;
      }
      if (b[bel[i]] % a[i] != 0) {
        yes = 0;
        break;
      }
      b[bel[i]] /= a[i];
    }
    if (yes) {
      long long ans = 0;
      int cnt = 0;
      bool psb = 1;
      for (int i = 0; i < n; i++) {
        if (bel[i] == i) {
          if (!is_prime[i]) ans += fact[i];
          ans++;
          cnt++;
          if (ans >= mii) {
            psb = 0;
            break;
          }
        }
      }
      if (psb) {
        for (int i = 0; i < n; i++) {
          if (bel[i] != i) {
            if (!is_prime[i]) {
              ans++;
              if (ans >= mii) {
                psb = 0;
                break;
              }
            }
          }
        }
        if (psb) {
          if (cnt > 1) ans++;
          mii = min(mii, ans);
        }
      }
    }
    ok = 0;
    if (dfs()) ok = 1;
  }
  printf("%I64d\n", mii);
  return 0;
}
