#include <bits/stdc++.h>
using namespace std;
int n;
long long a[16];
bool p[1000000];
vector<long long> v;
int c[16];
pair<long long, int> dp[1 << 10];
long long to = 1000000000000;
pair<long long, int> get(int msk) {
  if (dp[msk].first != -1) return dp[msk];
  long long val = 1;
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    if ((msk >> i) & 1) {
      long long x = val * a[i];
      if (x < 1) return dp[msk] = make_pair(0, 0);
      if (x / a[i] != val) return dp[msk] = make_pair(0, 0);
      val = x;
      sum += c[i];
    }
  }
  return dp[msk] = make_pair(val, sum);
}
int calc(int msk) {
  int s = 0;
  for (int i = 0; i < n; ++i) {
    if ((msk >> i) & 1) continue;
    ++s;
  }
  return s > 1;
}
int solve(int i, int MSK) {
  if (i == n) return calc(MSK);
  int mx = 1 << i;
  int ret = c[i] + solve(i + 1, MSK);
  if (c[i] > 1) {
    ++ret;
    for (int msk = 1; msk < mx; ++msk) {
      if (MSK & msk) continue;
      pair<long long, int> mul = get(msk);
      if (mul.first < 1) continue;
      if (a[i] % mul.first) continue;
      ret = min(ret, solve(i + 1, MSK | msk) + c[i] - mul.second + 1);
    }
  }
  return ret;
}
int main() {
  cin >> n;
  memset(dp, -1, sizeof(dp));
  v.push_back(2);
  for (int i = 3; i * i < 1000000; i += 2) {
    if (!p[i]) {
      for (int j = i * i; j < 1000000; j += i) p[j] = 1;
    }
  }
  for (int i = 3; i < 1000000; i += 2)
    if (!p[i]) v.push_back(i);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (int i = 0; i < n; ++i) {
    long long x = a[i];
    for (int j = 0; v[j] * v[j] <= x; ++j) {
      while (x % v[j] == 0) {
        c[i]++;
        x /= v[j];
      }
    }
    c[i] += x != 1;
  }
  cout << solve(0, 0) << endl;
  cin >> n;
}
