#include <bits/stdc++.h>
using namespace std;
int N;
long long A[10], rem[10];
int totnum, numv[10], pos[10], tat[10];
int result = 0x3f3f3f3f;
inline bool compare(const int& i1, const int& i2) {
  return numv[i1] > numv[i2];
}
void Back(int x) {
  if (x == N + 1) {
    int num0 = 0;
    for (int i = 1; i <= N; ++i)
      if (tat[i] == 0) ++num0;
    int resnow = (num0 >= 2) + N + totnum;
    for (int i = 1; i <= N; ++i)
      if (tat[i] != 0) resnow -= numv[pos[i]];
    result = min(result, resnow);
    return;
  }
  for (int i = 0; i <= x - 1; ++i)
    if (i == 0 || rem[pos[i]] % A[pos[x]] == 0) {
      rem[pos[i]] /= A[pos[x]];
      tat[x] = i;
      Back(x + 1);
      rem[pos[i]] *= A[pos[x]];
    }
}
int main() {
  cin >> N;
  for (int i = 1; i <= N; ++i) {
    cin >> A[i];
    long long aux = A[i];
    for (int j = 2; 1LL * j * j <= aux; ++j)
      while (aux % j == 0) {
        ++numv[i];
        aux /= j;
      }
    if (aux != 1) ++numv[i];
    totnum += numv[i];
    if (numv[i] == 1) --totnum;
    pos[i] = i;
    rem[i] = A[i];
  }
  sort(pos + 1, pos + N + 1, compare);
  Back(1);
  cout << result << '\n';
}
