#include <bits/stdc++.h>
using namespace std;
int dp[10][1200];
bool isp[1000007];
int pri[1000007], cnt;
long long a[10];
int num[10];
int check(long long x) {
  int ans = 0;
  for (int i = 0; i < cnt; ++i)
    if (x % pri[i] == 0) {
      while (x % pri[i] == 0) {
        x /= pri[i];
        ++ans;
      }
    }
  if (x > 1) ++ans;
  return ans;
}
int main() {
  cnt = 0;
  for (int i = 2; i * i < 1000007; ++i)
    if (!isp[i])
      for (int j = i * i; j < 1000007; j += i) isp[j] = 1;
  for (int i = 2; i < 1000007; ++i)
    if (!isp[i]) pri[cnt++] = i;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (int i = 0; i < n; ++i) num[i] = check(a[i]);
  memset(dp, 0x3f, sizeof(dp));
  if (num[0] > 1)
    dp[0][1] = num[0] + 1;
  else
    dp[0][1] = num[0];
  int ans, sum;
  long long tmp;
  for (int i = 1; i < n; ++i)
    for (int j = 0; j < (1 << i); ++j)
      if (dp[i - 1][j] - 0x3f3f3f3f) {
        int k = j;
        while (1) {
          sum = num[i];
          if (num[i] > 1) ++sum;
          tmp = a[i];
          for (int x = 0; x < i; ++x)
            if (k & (1 << x)) {
              if (tmp % a[x] == 0) {
                tmp /= a[x];
                sum -= num[x];
              } else {
                tmp = -1;
                break;
              }
            }
          if (tmp >= 1) {
            int x = (j - k) | (1 << i);
            dp[i][x] = min(dp[i][x], dp[i - 1][j] + sum);
          }
          if (k == 0) break;
          k = j & (k - 1);
        }
      }
  ans = 0x3f3f3f3f;
  for (int i = 0; i < (1 << n); ++i) {
    int x = 0;
    for (int j = 0; j < n; ++j)
      if (i & (1 << j)) ++x;
    tmp = dp[n - 1][i];
    if (x > 1) ++tmp;
    if (ans > tmp) ans = tmp;
  }
  cout << ans << endl;
}
