#include <bits/stdc++.h>
using namespace std;
const int MX = 8 + 2;
const long long int MXN = 10000000000000;
long long int data[MX];
int n;
int minNodes = 10000000;
const int CS = 1000000 + 10;
bool criba[CS];
int primes[CS], nPrimes = 0;
int leafsOf(long long int tmp) {
  if (tmp <= 1) return 0;
  long long int sqr = sqrt(tmp) + 1;
  int totalLeafs = 0;
  for (int j = 0; tmp != 1 && primes[j] <= sqr && j < nPrimes; j++) {
    int exp = 0;
    while (tmp % primes[j] == 0) {
      tmp /= primes[j];
      exp++;
    }
    totalLeafs += exp;
  }
  if (tmp != 1) totalLeafs++;
  return totalLeafs;
}
void backTrack(int tree[MX], long long int values[MX], int pos) {
  if (pos == n + 1) {
    int nchilds[MX];
    fill(nchilds, nchilds + MX, 0);
    for (int i = 0; i <= n; i++) {
      nchilds[tree[i]]++;
    }
    int totalNodes = 0;
    if (nchilds[0] > 1) totalNodes++;
    for (int i = 1; i <= n; i++) {
      int nleafs = leafsOf(values[i]);
      totalNodes++;
      if (nchilds[i] == 0 && nleafs == 1) {
      } else
        totalNodes += nleafs;
    }
    minNodes = min(minNodes, totalNodes);
  } else
    for (int i = 0; i < pos; i++) {
      if (data[i] == -1 || values[i] % data[pos] == 0) {
        long long int cvalues[MX];
        int ctree[MX];
        for (int j = 0; j < MX; j++) cvalues[j] = values[j];
        for (int j = 0; j < MX; j++) ctree[j] = tree[j];
        ctree[pos] = i;
        if (data[i] != -1) cvalues[i] /= data[pos];
        backTrack(ctree, cvalues, pos + 1);
      }
    }
}
int main() {
  fill(criba, criba + CS, true);
  criba[0] = criba[1] = false;
  for (int i = 0; i < CS; i++)
    if (criba[i])
      for (int j = 2 * i; j < CS; j += i) criba[j] = 0;
  for (int i = 0; i < CS; i++)
    if (criba[i]) primes[nPrimes] = i, nPrimes++;
  ;
  scanf("%d", &n);
  data[0] = MXN;
  for (int i = 1; i <= n; i++) {
    cin >> data[i];
  }
  sort(data, data + n + 1, greater<long long int>());
  data[0] = -1;
  int tree[MX];
  fill(tree, tree + MX, -1);
  long long int values[MX];
  for (int i = 0; i <= n; i++) values[i] = data[i];
  tree[0] = -1;
  backTrack(tree, values, 1);
  printf("%d\n", minNodes);
  return 0;
}
