#include <bits/stdc++.h>
using namespace std;
int n, primos;
long long int a[9];
int divisores[9];
vector<long long int> tree;
int bckt(int atual, int filhosRoot, int tot) {
  if (atual == n) {
    int cont = 0;
    if (filhosRoot > 1) cont++;
    return tot + n + cont - primos;
  }
  int resp = 1 << 29;
  for (int i = 0; i < tree.size(); i++) {
    if (tree[i] % a[atual] == 0) {
      tree[i] /= a[atual];
      tree.push_back(a[atual]);
      resp = min(resp, bckt(atual + 1, filhosRoot + (i == 0),
                            tot + (i == 0 ? divisores[atual] : 0)));
      tree[i] *= a[atual];
      tree.pop_back();
    }
  }
  return resp;
}
int main(void) {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  reverse(a, a + n);
  for (int i = 0; i < n; i++) {
    long long int aux = a[i];
    for (long long int j = 2; j * j <= aux; j++) {
      while (aux % j == 0) {
        aux /= j;
        divisores[i]++;
      }
    }
    if (aux > 1) divisores[i]++;
    if (divisores[i] == 1) primos++;
  }
  tree.push_back(0);
  cout << bckt(0, 0, 0) << endl;
  return 0;
}
