#include <bits/stdc++.h>
using namespace std;
const int N = 10;
long long num[N];
int cnt[N], ord[N];
int n, ans;
bool mark[N];
void update() {
  int ret = 0, sum = 0;
  for (int i = 1; i <= n; i++) {
    ret += cnt[i] + ord[i];
    if (!mark[i]) ++sum;
  }
  if (sum > 1) ++ret;
  if (ans == -1 || ret < ans) {
    ans = ret;
  }
}
void search(int x, int y, long long re) {
  if (x == 0) {
    update();
    return;
  }
  if (y == 0) {
    search(x - 1, x - 2, num[x - 1]);
    return;
  }
  if (re % num[y] == 0 && !mark[y]) {
    cnt[x] -= cnt[y];
    mark[y] = true;
    search(x, y - 1, re / num[y]);
    mark[y] = false;
    cnt[x] += cnt[y];
  }
  search(x, y - 1, re);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) cin >> num[i];
  sort(num + 1, num + n + 1);
  for (int i = 1; i <= n; i++) {
    cnt[i] = ord[i] = 0;
    long long k = num[i];
    for (int j = 2; (long long)j * j <= k; j++)
      while (k % j == 0) {
        k = k / j;
        ++cnt[i];
      }
    if (k != 1) ++cnt[i];
    if (k != num[i]) ord[i] = 1;
  }
  ans = -1;
  memset(mark, 0, sizeof mark);
  search(n, n - 1, num[n]);
  cout << ans << endl;
}
