#include <bits/stdc++.h>
using namespace std;
long long a[10], rest[10];
int n, res = 1e9, pre[10], tmp, size[10], flag = 0;
vector<int> ve[10];
map<long long, long long> mp;
int count(long long x) {
  if (mp[x]) return mp[x];
  long long tmp = x;
  long long res = 0;
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      while (x % i == 0) {
        x /= i;
        res++;
      }
    }
  }
  if (x > 1) res++;
  return mp[tmp] = res;
}
bool prime(long long x) {
  if (x == 2 || x == 3) return true;
  for (long long i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
int isprime[10] = {0};
void cal(int now) {
  tmp++;
  if (size[now] == 0) {
    if (!isprime[now]) tmp += count(a[now]);
    return;
  }
  if (now) {
    if (rest[now]) tmp += count(rest[now]);
  }
  for (int i = 0; i < size[now]; i++) {
    cal(ve[now][i]);
    if (flag) return;
  }
}
void dfs(int pos) {
  if (pos == n + 1) {
    tmp = 0;
    flag = 0;
    for (int i = 0; i <= n; i++) {
      ve[i].clear();
      size[i] = 0;
    }
    for (int i = 1; i <= n; i++) {
      size[pre[i]]++;
      ve[pre[i]].push_back(i);
    }
    cal(0);
    if (size[0] == 1) {
      tmp -= 1;
    }
    if (flag) tmp = 1e9;
    if (tmp < res) {
      res = tmp;
    }
    return;
  }
  for (int i = 0; i < pos; i++) {
    if (i && rest[i] % a[pos]) continue;
    rest[i] = rest[i] / a[pos];
    pre[pos] = i;
    dfs(pos + 1);
    rest[i] *= a[pos];
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lld", a + i);
  sort(a + 1, a + n + 1, greater<long long>());
  for (int i = 1; i <= n; i++) {
    rest[i] = a[i];
    if (prime(a[i])) isprime[i] = 1;
  }
  dfs(1);
  printf("%d\n", res);
}
