#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
long long a[10], n, rem[10], par[10], res = N, rem_factors[10], factors[10];
inline bool is_prime(long long u) {
  if (u == 1) return false;
  if (u == 2) return true;
  if (u % 2 == 0) return false;
  for (long long i = 3; i * i <= u; i += 2)
    if (u % i == 0) return false;
  return true;
}
int get(long long u) {
  if (u == 1) return 0;
  if (is_prime(u)) return 1;
  int res = 0;
  while (u % 2 == 0) {
    u /= 2;
    res++;
  }
  if (u == 1) return res;
  if (is_prime(u)) {
    return res + 1;
  }
  for (long long i = 3; i * i <= u; i += 2) {
    while (u % i == 0) {
      res++;
      u /= i;
    }
  }
  if (u > 2) res++;
  return res;
}
int PRIME[10];
void backtrack(int idx) {
  if (idx == n) {
    int val = 0, cnt_par = 0;
    for (int i = 0; i < n; i++) {
      if (!PRIME[i]) val += rem_factors[i];
      cnt_par += (par[i] != -1);
    }
    if (n - cnt_par > 1)
      res = min(res, val + n + 1);
    else
      res = min(res, val + n);
    return;
  }
  for (int i = idx + 1; i < n; i++) {
    if (rem[i] >= a[idx] && a[i] > a[idx] && rem[i] % a[idx] == 0) {
      rem[i] /= a[idx];
      rem_factors[i] -= factors[idx];
      par[idx] = i;
      backtrack(idx + 1);
      rem_factors[i] += factors[idx];
      par[idx] = -1;
      rem[i] *= a[idx];
    }
  }
  backtrack(idx + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  scanf("%d", &n);
  memset(par, -1, sizeof(par));
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
  sort(a, a + n);
  for (int i = 0; i < n; i++) rem[i] = a[i];
  for (int i = 0; i < n; i++) PRIME[i] = is_prime(a[i]);
  for (int i = 0; i < n; i++) {
    rem_factors[i] = get(a[i]);
    factors[i] = rem_factors[i];
  }
  backtrack(0);
  printf("%d\n", res);
  return 0;
}
