#include <bits/stdc++.h>
using namespace std;
long long a[10];
long long b[10];
int x[10];
vector<int> p;
bitset<1000100> B;
int ans, anstmp;
int tree;
int n;
void go(int y) {
  if (y == n) {
    ans = min(ans, anstmp + (tree > 1));
    return;
  }
  for (int i = (y + 1); i < (n); ++i) {
    if (b[i] % a[y] == 0) {
      b[i] /= a[y];
      anstmp -= max(x[y], 1);
      tree--;
      go(y + 1);
      b[i] *= a[y];
      anstmp += max(x[y], 1);
      tree++;
    }
  }
  go(y + 1);
}
int main() {
  p.push_back(2);
  for (int i = 3; i < 1000000; i += 2) {
    if (!B[i]) p.push_back(i);
    for (int j = 0; j < p.size() && i * p[j] < 1000000; j++) {
      B[i * p[j]] = 1;
    }
  }
  scanf("%d", &(n));
  for (int i = (0); i < (n); ++i) cin >> a[i];
  sort(a, a + n);
  for (int i = (0); i < (n); ++i) {
    x[i] = 0;
    b[i] = a[i];
    long long tmp = a[i];
    for (int j = 0; j < p.size() && tmp > 1; j++) {
      while (tmp % p[j] == 0) {
        tmp /= p[j];
        x[i]++;
      }
    }
    if (tmp != 1) x[i]++;
    if (x[i] == 1) x[i]--;
  }
  ans = n;
  tree = n;
  for (int i = (0); i < (n); ++i) {
    ans += x[i];
  }
  anstmp = ans;
  ans += (n > 1);
  go(0);
  cout << ans << endl;
  return 0;
}
