#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000009;
long long a[10], b[10], c[10], n;
bool d[10];
bool isprime(long long k) {
  if (k == 2) return 1;
  if (k == 1) return 0;
  if (k % 2 == 0) return 0;
  for (long long i = 3; i * i <= k; i += 2)
    if (k % i == 0) return 0;
  return 1;
}
long long ted(long long k) {
  long long ans = 0;
  while (k % 2 == 0) {
    ans++;
    k /= 2;
  }
  for (long long i = 3; i * i <= k; i += 2) {
    while (k % i == 0) {
      ans++;
      k /= i;
    }
  }
  if (k > 1) ans++;
  return ans;
}
long long bt(int t, long long val) {
  if (t == n) {
    return val;
  }
  long long ans = bt(t + 1, val);
  for (int i = t + 1; i < n; i++) {
    if ((a[i] / c[i]) % a[t] == 0) {
      c[i] *= a[t];
      d[t] = 1;
      ans = min(ans, bt(t + 1, val - b[t]));
      c[i] /= a[t];
      d[t] = 0;
    }
  }
  bool r = 1;
  for (int i = 0; i < n - 1; i++) r = r and d[i];
  if (r) ans--;
  return ans;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    b[i] = ted(a[i]);
    c[i] = 1;
  }
  long long m = n + 1;
  for (int i = 0; i < n; i++) m += b[i];
  for (int i = 0; i < n; i++) m -= isprime(a[i]);
  long long ans = bt(0, m);
  cout << ans << endl;
  return 0;
}
