#include <bits/stdc++.h>
using namespace std;
long long val[20], child[20], prdiv[20], vprdiv[20];
vector<long long> arr, prime;
int n;
bool isprime(long long val) {
  for (int i = 0; i < prime.size(); i++)
    if (val % prime[i] == 0 && prime[i] != val) return false;
  return true;
}
int rec(int ix, int ixa) {
  int ret = 100000, tix;
  long long tval;
  if (ixa == n) {
    ret = 0;
    for (int i = 0; i < ix; i++)
      if (val[i] != -1) {
        if (child[i] == 0 && vprdiv[i] < 2)
          ret++;
        else {
          ret += (vprdiv[i] + 1);
        }
      } else
        ret++;
    return ret;
  }
  if (ix == 0) {
    val[ix] = arr[ixa];
    vprdiv[ix] = prdiv[ixa];
    ret = rec(ix + 1, ixa + 1);
    val[ix] = -1;
    vprdiv[ix] = 0;
  }
  for (int i = 0; i < ix; i++) {
    if (val[i] == -1) {
      child[i]++;
      val[ix] = arr[ixa];
      vprdiv[ix] = prdiv[ixa];
      ret = min(ret, rec(ix + 1, ixa + 1));
      child[i]--;
      val[ix] = -1;
      vprdiv[ix] = 0;
    } else if (val[i] % arr[ixa] == 0) {
      child[i]++;
      val[i] /= arr[ixa];
      vprdiv[i] -= prdiv[ixa];
      val[ix] = arr[ixa];
      vprdiv[ix] = prdiv[ixa];
      ret = min(ret, rec(ix + 1, ixa + 1));
      child[i]--;
      val[i] *= arr[ixa];
      vprdiv[i] += prdiv[ixa];
      val[ix] = -1;
      vprdiv[ix] = 0;
    }
  }
  return ret;
}
void loadpr() {
  static int MAXV = 1000005;
  bool *pr;
  pr = new bool[MAXV];
  memset(pr, true, sizeof(bool) * MAXV);
  for (int i = 2; i < MAXV; i++)
    if (pr[i]) {
      prime.push_back(i);
      for (int j = i * 2; j < MAXV; j += i) pr[j] = false;
    }
  return;
}
void doit() {
  long long tval;
  int tix = 0;
  memset(val, -1, sizeof(val));
  memset(child, 0, sizeof(child));
  memset(prdiv, 0, sizeof(prdiv));
  memset(vprdiv, 0, sizeof(vprdiv));
  loadpr();
  cin >> n;
  arr.resize(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  sort(arr.begin(), arr.end(), std::greater<long long>());
  for (int i = 0; i < n; i++) {
    tval = arr[i];
    tix = 0;
    while (tval > 1 && tix < prime.size()) {
      if (tval % prime[tix] == 0) {
        prdiv[i]++;
        tval /= prime[tix];
      } else
        tix++;
    }
    if (tval > 1) prdiv[i]++;
  }
  cout << min(rec(0, 0), rec(1, 0)) << endl;
  return;
}
int main() {
  doit();
  return 0;
}
