#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
int q[8];
long long a[8], t[9];
int result, i, n, st, rc, dp;
int nrp(long long a0) {
  int t = 0;
  for (int j = 2; 1LL * j * j <= a0; ++j)
    while (a0 % j == 0) a0 /= j, t++;
  if (a0 > 1) t++;
  return t;
}
void bkt(int stp) {
  if (stp == n) {
    if (rc >= 2)
      result = min(result, dp + 1);
    else
      result = min(result, dp);
    return;
  }
  for (int i = 0; i < st; ++i)
    if (t[i] % a[stp] == 0) {
      t[st++] = a[stp];
      t[i] /= a[stp];
      int rc0 = rc, dp0 = dp;
      if (i == 0) {
        rc = rc + 1;
        dp = dp + q[stp];
      }
      bkt(stp + 1);
      rc = rc0, dp = dp0;
      st--;
      t[i] *= a[stp];
    }
}
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; ++i) scanf("%I64d", &a[i]);
  sort(a, a + n);
  reverse(a, a + n);
  for (i = 0; i < n; ++i) q[i] = nrp(a[i]);
  t[st++] = 0;
  result = INF;
  bkt(0);
  for (i = 0; i < n; ++i)
    if (q[i] >= 2) result++;
  printf("%d\n", result);
  return 0;
}
