#include <bits/stdc++.h>
using namespace std;
inline long long fpm(long long a, long long b, long long p) {
  long long w = 1;
  for (; b; b >>= 1, a = a * a % p) b& 1 ? w = w * a % p : 0;
  return w;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline T zbs(T x) {
  return x > 0 ? x : -x;
}
template <class T>
inline bool maxit(T& a, T b) {
  return b > a ? a = b, true : false;
}
template <class T>
inline bool minit(T& a, T b) {
  return b < a ? a = b, true : false;
}
struct edge {
  int to, nx;
};
bool flag[2000020];
int n;
long long A[12], w[12];
vector<long long> P[12];
int sz[12];
int G[12][12];
int vis[12], V;
int Ans = (int)1e9;
void sieve() {
  for (int i = 2; i <= 1000000; i++)
    if (!flag[i]) {
      for (int j = i; j <= 1000000; j++) {
        long long k = (long long)i * j;
        if (k > 1000000)
          break;
        else
          flag[k] = 1;
      }
    }
}
bool cmp(const long long& i, const long long& j) { return i > j; }
void divi(int i, long long x) {
  int sq = (int)sqrt((double)x);
  for (long long y = 2; y <= sq; y++) {
    if (!flag[y])
      while (x % y == 0) P[i].push_back(y), x /= y;
    if (x == 1) break;
  }
  if (x > 1) P[i].push_back(x);
  sz[i] = P[i].size();
}
void go(int d) {
  vis[d] = V;
  for (int k = 1; k <= n; k++)
    if (G[d][k]) go(k);
}
void check() {
  int K = -1, Now = 0;
  V++;
  for (int i = 1; i <= n; i++)
    if (vis[i] != V) K++, go(i);
  for (int i = 1; i <= n; i++) {
    int cnt = sz[i];
    for (int j = 1; j <= n; j++)
      if (G[i][j]) cnt -= sz[j];
    if (sz[i] == 1) cnt = 0;
    Now += cnt;
  }
  K = (K > 0) ? 1 : 0;
  Ans = min(Ans, K + Now);
}
void dfs(int c) {
  if (c > n) {
    check();
    return;
  }
  dfs(c + 1);
  for (int i = 1; i <= c - 1; i++)
    if (w[i] % A[c] == 0) {
      w[i] = w[i] / A[c], G[i][c] = 1;
      dfs(c + 1);
      w[i] = w[i] * A[c], G[i][c] = 0;
    }
}
int main() {
  sieve();
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> A[i];
  sort(A + 1, A + n + 1, cmp);
  for (int i = 1; i <= n; i++) divi(i, A[i]);
  for (int i = 1; i <= n; i++) w[i] = A[i];
  dfs(1);
  cout << Ans + n << endl;
}
