#include <bits/stdc++.h>
using namespace std;
long long a[10];
long long b[10];
int num[10];
int p[10];
int vis[10];
int n;
int wa;
void dfs(int pos) {
  if (pos == n) {
    int cnt = 0, sum = 0;
    for (int i = 0; i < n; i++) {
      b[i] = a[i];
      sum += num[i];
      if (num[i] != 1) sum++;
      if (p[i] == -1) {
        cnt++;
        continue;
      }
      if (a[p[i]] % a[i] != 0) return;
    }
    for (int i = 0; i < n; i++) {
      if (p[i] == -1) continue;
      if (b[p[i]] % a[i] != 0) return;
      b[p[i]] /= a[i];
      sum -= num[i];
    }
    if (cnt > 1) sum++;
    wa = min(wa, sum);
    return;
  }
  for (int i = -1; i < n; i++) {
    p[pos] = i;
    if (pos == i) continue;
    dfs(pos + 1);
  }
}
int main() {
  scanf("%d", &n);
  wa = 0x3f3f3f3f;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
    long long t = a[i];
    long long ed = sqrt(t);
    int cnt = 0;
    for (long long j = 2; j <= ed; j++) {
      while (t % j == 0) {
        t /= j;
        cnt++;
      }
    }
    if (t > 1) cnt++;
    num[i] = cnt;
  }
  int cnt = 0;
  dfs(0);
  printf("%d\n", wa);
}
