#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline T lcm(T a, T b) {
  if (a < 0) return lcm(-a, b);
  if (b < 0) return lcm(a, -b);
  return a * (b / __gcd(a, b));
}
template <class T>
T power(T N, T P) {
  return (P == 0) ? 1 : N * power(N, P - 1);
}
template <class T>
string itoa(T a) {
  if (!a) return "0";
  string ret;
  for (T i = a; i > 0; i = i / 10) ret.push_back((i % 10) + 48);
  reverse(ret.begin(), ret.end());
  return ret;
}
double log(double N, double B) { return (log10l(N)) / (log10l(B)); }
vector<string> token(string a, string b) {
  const char *q = a.c_str();
  while (count(b.begin(), b.end(), *q)) q++;
  vector<string> oot;
  while (*q) {
    const char *e = q;
    while (*e && !count(b.begin(), b.end(), *e)) e++;
    oot.push_back(string(q, e));
    q = e;
    while (count(b.begin(), b.end(), *q)) q++;
  }
  return oot;
}
string toBin(int n) {
  string s;
  for (int i = 32 - 1; i >= 0; i--) s += ((bool)(n & (1 << (i))) + '0');
  return s;
}
bool eq(long double a, long double b) { return fabs(a - b) < 1e-9; }
int const MAXP = 1000000;
long long chk[(MAXP / 64) + 2];
long long prime[1000000];
void siv() {
  int sq = sqrt(MAXP);
  for (int i = 3; i <= sq; i += 2)
    if (!(chk[i >> 6] & (1 << ((i >> 1) & 31)))) {
      int k = i << 1;
      for (int j = (i * i); j < MAXP; j += k)
        (chk[j >> 6] |= (1 << ((j >> 1) & 31)));
    }
  int c = 0;
  prime[c++] = 2;
  for (int i = 3; i <= MAXP; i += 2)
    if (!(chk[i >> 6] & (1 << ((i >> 1) & 31)))) {
      prime[c++] = i;
    }
}
int fact(long long n) {
  long long sq = sqrt(n), c = 0;
  for (long long i = 0; prime[i] <= sq; i++) {
    if (n % prime[i] == 0) {
      while (n % prime[i] == 0) {
        n /= prime[i];
        c++;
      }
      sq = sqrt(n);
    }
  }
  c += (n > 1);
  return c;
}
int n, child[10];
long long a[10];
vector<long long> tree;
long long node = 0, part, cc = 0, ans = 1 << 29;
int call(int idx, int part, int leaf) {
  if (idx == n) {
    return leaf + (part > 1) + n;
  }
  int ans = 1 << 29;
  long long val = a[idx];
  for (int i = 0; i < (int)(int)tree.size(); i++) {
    if (tree[i] % val == 0) {
      tree[i] /= val;
      tree.push_back(val);
      long long add = 0;
      if (i == 0) add = child[idx];
      int ret = call(idx + 1, part + (i == 0), leaf + add);
      tree[i] *= val;
      tree.pop_back();
      ans = min(ans, ret);
    }
  }
  return ans;
}
int main() {
  siv();
  cin >> n;
  for (int i = 0; i < (int)n; i++) {
    cin >> a[i];
  }
  sort(a, a + n, greater<long long>());
  int prm = 0;
  for (int i = 0; i < (int)n; i++) {
    child[i] = fact(a[i]);
    if (child[i] == 1) prm++;
  }
  tree.push_back(0);
  ans = call(0, 0, 0);
  cout << ans - prm << endl;
}
