#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void next_int(T &x) {
  x = 0;
  char c;
  bool neg = false;
  while (!isdigit(c = getchar()))
    if (c == '-') neg = true;
  do x = x * 10 + c - 48;
  while (isdigit(c = getchar()));
  if (neg) x = -x;
}
template <typename T>
inline void write_int(T x, char last = 0) {
  if (x < 0) putchar('-'), x = abs(x);
  char tmp[20];
  int cnt = 0;
  while (x >= 10) tmp[cnt++] = x % 10 + 48, x /= 10;
  tmp[cnt] = x + 48;
  for (int i = (cnt); i >= (0); --i) putchar(tmp[i]);
  if (last) putchar(last);
}
int n, isprime;
vector<long long> a, tmp;
vector<int> fact;
int solve(int idx, int leafCnt, int adjRoot) {
  if (idx == n) return n + (adjRoot > 1) + leafCnt - isprime;
  int ret = (int)1e9 + 7;
  for (int i = (0); i < (((int)tmp.size())); ++i)
    if (tmp[i] % a[idx] == 0) {
      tmp[i] /= a[idx], tmp.push_back(a[idx]);
      ret = min(ret, solve(idx + 1, leafCnt + (i == 0 ? fact[idx] : 0),
                           adjRoot + (i == 0)));
      tmp[i] *= a[idx], tmp.pop_back();
    }
  return ret;
}
int main() {
  scanf("%d", &n);
  a.resize(n), fact.resize(n);
  for (int i = (0); i < (n); ++i) scanf("%I64d", &a[i]);
  sort(a.begin(), a.end(), greater<long long>());
  for (int i = (0); i < (n); ++i) {
    long long lmt = sqrt(a[i]), x = a[i];
    for (long long j = 2; j <= lmt; ++j) {
      if (a[i] == 1) break;
      while (x % (long long)j == 0) ++fact[i], x /= (long long)j;
    }
    if (x > 1) ++fact[i];
    if (x == a[i]) ++isprime;
  }
  tmp.push_back(0);
  printf("%d", solve(0, 0, 0));
  return 0;
}
