#include <bits/stdc++.h>
using namespace std;
long long int _sieve_size;
bitset<20000010> bs;
vector<int> primes;
void sieve(long long int upperbound) {
  _sieve_size = upperbound + 1;
  bs.reset();
  bs.flip();
  bs.set(0, false);
  bs.set(1, false);
  for (long long int i = 2; i <= _sieve_size; i++)
    if (bs.test((size_t)i)) {
      for (long long int j = i * i; j <= _sieve_size; j += i)
        bs.set((size_t)j, false);
      primes.push_back((int)i);
    }
}
bool isPrime(long long int N) {
  if (N < _sieve_size) return bs.test(N);
  for (int i = int(0); i <= int(primes.size() - 1); i++) {
    if (N % primes[i] == 0) return false;
    if (primes[i] > sqrt(N)) return true;
  }
  return true;
}
int primeFactors(long long int N) {
  int factors = 0;
  long long int PF_idx = 0;
  long long int PF = primes[PF_idx];
  while (PF * PF <= N) {
    while (N % PF == 0) {
      N /= PF;
      factors++;
    }
    PF = primes[++PF_idx];
  }
  if (N > 1) factors++;
  return factors;
}
long long int a[20];
int n, ch[20], mini, ans;
void rec(int i, int j, int k) {
  if (i == n) {
    int temp = 0;
    for (int i = int(0); i <= int(n - 1); i++) {
      if (!ch[i]) temp++;
    }
    if (temp > 1)
      temp = 1;
    else
      temp = 0;
    mini = min(mini, ans + temp);
    return;
  }
  if (j == n) {
    int temp = primeFactors(a[i]);
    if (temp > 1 || k) temp++;
    ans += temp;
    rec(i + 1, i + 2, 0);
    ans -= temp;
  } else {
    if (a[i] % a[j] == 0 && !ch[j]) {
      ch[j] = 1;
      a[i] /= a[j];
      rec(i, j + 1, 1);
      a[i] *= a[j];
      ch[j] = 0;
    }
    rec(i, j + 1, k);
  }
}
int main() {
  ans = 0;
  mini = 2000000000;
  sieve(10000000);
  scanf("%d", &n);
  for (int i = int(0); i <= int(n - 1); i++) scanf("%lld", &a[i]);
  sort(a, a + n);
  reverse(a, a + n);
  rec(0, 1, 0);
  printf("%d\n", mini);
  return 0;
}
