#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10;
int n, num[MAXN], son[MAXN], fa[MAXN];
long long a[MAXN];
long long Count(long long a) {
  long long X = a, cnt = 0;
  for (long long j = 2; j * j <= X; ++j)
    while (X % j == 0) {
      ++cnt, X /= j;
    }
  if (X > 1) ++cnt;
  return cnt;
}
int Tohka = 1 << 30;
void DFS(int first) {
  if (!first) {
    int cnt = 0, sum = 0;
    for (int i = 1; i <= n; ++i) {
      if (fa[i] == n + 1) {
        ++cnt;
        sum += num[i];
      }
      if (!son[i] && num[i] == 1) --sum;
    }
    sum += cnt > 1;
    Tohka = min(Tohka, sum + n);
    return;
  }
  for (int i = first + 1; i <= n + 1; ++i)
    if (a[i] % a[first] == 0) {
      fa[first] = i, ++son[i];
      a[i] /= a[first];
      DFS(first - 1);
      fa[first] = 0, --son[i];
      a[i] *= a[first];
    }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; ++i) num[i] = Count(a[i]);
  DFS(n);
  cout << Tohka << endl;
  fclose(stdin);
  fclose(stdout);
  return 0;
}
