#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const int inf = 10000000;
long long arr[8], t[8];
int divs[8];
int n;
int solve(int i, int rootchild) {
  if (i == n) return rootchild > 1;
  int ans = inf;
  ans = min(ans, solve(i + 1, rootchild + 1) + divs[i] + (divs[i] > 1));
  for (int j = 0; j < (i); j++)
    if (t[j] % arr[i] == 0) {
      t[j] /= arr[i];
      ans = min(ans, solve(i + 1, rootchild) + (divs[i] > 1));
      t[j] *= arr[i];
    }
  return ans;
}
int main() {
  cin >> n;
  for (int i = 0; i < (n); i++) cin >> arr[i];
  sort(arr, arr + n, greater<long long>());
  for (int i = 0; i < (n); i++) {
    long long x = arr[i];
    for (long long j = 2; j * j <= x; j++) {
      while (x % j == 0) {
        divs[i]++;
        x /= j;
      }
    }
    if (x > 1) divs[i]++;
  }
  for (int i = 0; i < (n); i++) t[i] = arr[i];
  cout << solve(0, 0) << endl;
  return 0;
}
