#include <bits/stdc++.h>
using namespace std;
const int MAXPRIME = 1000033;
const int MAXPRIMES = 1000000;
int primes[MAXPRIMES];
int primesn;
int isnotprime[MAXPRIME + 1];
void getprimes2() {
  memset(isnotprime, 0, sizeof(isnotprime));
  primesn = 1;
  primes[0] = 2;
  for (int i = 3; i <= MAXPRIME; i += 2)
    if (!isnotprime[i]) {
      primes[primesn++] = i;
      for (int x = i + i; x <= MAXPRIME; x += i) isnotprime[x] = 1;
    }
}
int n;
const long long INF = numeric_limits<long long>::max();
long long a[8];
int parent[8];
long long ta[8];
map<long long, int> primeFactors;
int countPrimeFactors(long long x) {
  if (primeFactors.find(x) == primeFactors.end()) {
    int res = 0;
    if (x == 1) {
      res = 0;
    } else {
      for (int i = 0; i < primesn; i++) {
        if (primes[i] > x / primes[i]) {
          break;
        }
        if (x % primes[i] == 0) {
          res = 1 + countPrimeFactors(x / primes[i]);
          break;
        }
      }
      if (res == 0) {
        res = 1;
      }
    }
    primeFactors[x] = res;
  }
  return primeFactors[x];
}
long long best;
void backtrack(int x) {
  if (x == n) {
    long long tree[n + 1];
    for (int i = 0; i <= n; i++) {
      tree[i] = 0;
      int children = 0;
      for (int j = 0; j < i; j++) {
        if (parent[j] == i) {
          children++;
          tree[i] += tree[j];
        }
      }
      if ((i != n) && (ta[i] != 1)) {
        int f = countPrimeFactors(ta[i]);
        tree[i] += f;
        children += f;
      }
      if (children > 1) {
        tree[i]++;
      }
    }
    best = std::min(best, tree[n]);
  } else {
    for (int i = x + 1; i < n; i++) {
      if (ta[i] % a[x] == 0) {
        parent[x] = i;
        ta[i] /= a[x];
        backtrack(x + 1);
        ta[i] *= a[x];
      }
    }
    parent[x] = n;
    backtrack(x + 1);
  }
}
long long solve() {
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    ta[i] = a[i];
  }
  best = numeric_limits<long long>::max();
  backtrack(0);
  return best;
}
void init() { getprimes2(); }
int main() {
  ios::sync_with_stdio(0);
  init();
  bool prev = false;
  while (cin >> n) {
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    if (prev) {
      cout << endl;
    }
    cout << solve() << endl;
    prev = true;
  }
  return 0;
}
