#include <bits/stdc++.h>
using namespace std;
const int INF = (1 << 28);
int n;
long long* a;
int f(long long x, bool p) {
  int c = 0;
  for (long long i = 2; i * i <= x; i++) {
    while (x % i == 0) {
      c++;
      x /= i;
    }
  }
  if (x != 1) c++;
  if (c == 1 && p) return 0;
  return c;
}
int t[8];
long long* b;
int f_[8];
int _f[8];
int g() {
  int c = n;
  int r = 0;
  for (int i = 0; i < n; i++) {
    if (t[i] == -1) {
      r++;
    }
  }
  if (r > 1) c++;
  for (int i = 0; i < n; i++) b[i] = a[i];
  for (int i = 0; i < n; i++) {
    c += f_[i];
    for (int j = 0; j < n; j++) {
      if (i == t[j]) {
        if (b[i] % a[j] != 0) return INF;
        b[i] /= a[j];
        c -= _f[j];
      }
    }
  }
  return c;
}
int dfs(int c) {
  if (c == n) {
    return g();
  }
  int ans = INF;
  for (int i = -1; i < c; i++) {
    t[c] = i;
    ans = min(ans, dfs(c + 1));
  }
  return ans;
}
int main() {
  cin >> n;
  a = new long long[n];
  b = new long long[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n, greater<long long>());
  for (int i = 0; i < n; i++) f_[i] = f(a[i], true);
  for (int i = 0; i < n; i++) _f[i] = f(a[i], false);
  cout << dfs(0) << endl;
  delete[] a;
  delete[] b;
  return 0;
}
