#include <bits/stdc++.h>
using namespace std;
bool isPrime[1000000 + 1];
vector<int> P;
void sieve() {
  fill(isPrime, isPrime + 1000000 + 1, true);
  isPrime[0] = isPrime[1] = false;
  for (int i = 0; i <= 1000000; i++) {
    if (!isPrime[i]) continue;
    for (long long j = (long long)i * i; j <= 1000000; j += i)
      isPrime[j] = false;
    P.push_back(i);
  }
}
int npf(long long x) {
  int i = 0, r = 0;
  while ((long long)P[i] * P[i] <= x) {
    while (x % P[i] == 0) x /= P[i], r++;
    i++;
  }
  return r + (x != 1);
}
int res = 11111111;
long long a[8];
int f[8];
int n;
void rec(int i, int size, bool super) {
  if (i == n) {
    res = min(res, size + super);
    return;
  }
  rec(i + 1, size + (f[(i)] + (f[(i)] > 1)), true);
  if (i == 0) rec(i + 1, (f[(i)] + (f[(i)] > 1)), false);
  int nsize;
  for (int j = 0; j < i; j++) {
    if (a[j] % a[i] == 0) {
      a[j] /= a[i];
      nsize = size + (f[i] > 1);
      rec(i + 1, nsize, super);
      a[j] *= a[i];
    }
  }
}
int main() {
  sieve();
  while (scanf("%d", &n) != EOF) {
    for (int i = 0; i < n; i++) scanf("%lld", a + i);
    res = 111111111;
    sort(a, a + n);
    reverse(a, a + n);
    for (int i = 0; i < n; i++) f[i] = npf(a[i]);
    rec(0, 0, false);
    printf("%d\n", res);
  }
  return 0;
}
