#include <bits/stdc++.h>
using namespace std;
long long a[8], pro[1 << 8];
int bit_cnt[1 << 8];
vector<long long> pp;
bitset<1000000> p;
map<long long, int> H;
int N, an;
int qq(long long x) {
  if (H.count(x)) return H[x];
  long long X = x;
  int res = 0;
  for (int i = 0; i < ((int)(pp).size()) && pp[i] * pp[i] <= x; i++) {
    while (x % pp[i] == 0) {
      x /= pp[i];
      res++;
    }
  }
  if (x != 1) res++;
  return H[X] = res;
}
int qq2(long long x) {
  if (H.count(x)) {
    int tmp = H[x];
    if (tmp == 1) return 0;
    return tmp;
  }
  long long X = x;
  int res = 0;
  for (int i = 0; i < ((int)(pp).size()) && pp[i] * pp[i] <= x; i++) {
    while (x % pp[i] == 0) {
      x /= pp[i];
      res++;
    }
  }
  if (x != 1) res++;
  H[X] = res;
  if (res == 1) return 0;
  return res;
}
void dfs(int x, int mask, int v, int head) {
  if (x == -1) {
    if (head == 1)
      an = min(an, v);
    else
      an = min(an, v + 1);
    return;
  }
  if (!((mask >> x) & 1)) {
    v++;
    head++;
  }
  for (int i = 0; i < (1 << x); ++i) {
    if (!i) {
      dfs(x - 1, mask, v + qq2(a[x]), head);
    } else if (!(mask & i) && a[x] % pro[i] == 0) {
      dfs(x - 1, mask | i, v + bit_cnt[i] + qq(a[x] / pro[i]), head);
    }
  }
}
int main() {
  for (int i = 3; i < 1000; i += 2) {
    for (int j = i * i; j < 1000000; j += i + i) p[j] = 1;
  }
  pp.push_back(2);
  for (int i = 3; i < 1000000; i += 2) {
    if (!p[i]) pp.push_back(i);
  }
  int(n);
  scanf("%d", &n);
  N = n;
  for (int i = 0; i < (n); ++i) cin >> a[i];
  sort(a, a + n);
  pro[0] = 1;
  for (int i = (1); i < (1 << n); ++i) {
    int k = 0;
    while (!((i >> k) & 1)) k++;
    bit_cnt[i] = bit_cnt[i - (1 << k)] + 1;
    long long tmp1 = pro[i - (1 << k)];
    long long tmp2 = a[k];
    if (tmp1 > 10000000000000ll / tmp2)
      pro[i] = 10000000000000ll;
    else
      pro[i] = tmp1 * tmp2;
  }
  an = 1000000;
  dfs(n - 1, 0, 0, 0);
  printf("%d\n", an);
  return 0;
}
