#include <bits/stdc++.h>
using namespace std;
inline int read() {
  static int r, sign;
  static char c;
  r = 0, c = getchar(), sign = 1;
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') sign = -1, c = getchar();
  while (c >= '0' && c <= '9') r = r * 10 + (c - '0'), c = getchar();
  return r * sign;
}
template <typename T>
inline void print(T* a, int n) {
  for (int i = 1; i < n; ++i) cout << a[i] << " ";
  cout << a[n] << endl;
}
long long a[8 + 1], m;
int n, f[2][1 << 8 | 1], p[1000000 + 1], tot = 0;
bool v[1000000 + 1];
inline int decompose(long long x) {
  int ret = 0;
  for (int i = 0; i < tot && (long long)p[i] * p[i] <= x; ++i)
    while (!(x % (long long)p[i])) x /= (long long)p[i], ++ret;
  if (x > 1LL) ++ret;
  return ret;
}
inline int calc(int x) { return x != 1 ? x + 1 : 1; }
int main(int argc, char* argv[]) {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%I64d", a + i);
  sort(a + 1, a + n + 1);
  m = ceil(sqrt((double)a[n]));
  for (int i = 2; i <= m; ++i) {
    if (!v[i]) p[tot++] = i;
    for (int j = 0; j < tot && i * p[j] <= m; ++j) {
      v[i * p[j]] = true;
      if (!(i % p[j])) break;
    }
  }
  memset(f, 127, sizeof f);
  f[1][1] = calc(decompose(a[1]));
  for (int i = 2; i <= n; ++i) {
    int now = i & 1, last = i & 1 ^ 1;
    for (int x = 0; x < (1 << i); ++x) f[now][x] = 12345678;
    for (int x = 1 << i - 2; x < (1 << i - 1); ++x) {
      for (int y = x; y > 0; y = (y - 1) & x) {
        long long cur = a[i];
        for (int j = 1; cur && j < i; ++j)
          if (y & (1 << j - 1)) {
            if (!(cur % a[j]))
              cur /= a[j];
            else
              cur = 0LL;
          }
        if (!cur) continue;
        f[now][x - y | (1 << i - 1)] = f[last][x] + decompose(cur) + 1;
      }
      f[now][x | (1 << i - 1)] = f[last][x] + calc(decompose(a[i]));
    }
  }
  int ans = 12345678;
  for (int x = 1 << n - 1; x < (1 << n); ++x)
    if (__builtin_popcount(x) == 1)
      ans = min(ans, f[n & 1][x]);
    else
      ans = min(ans, f[n & 1][x] + 1);
  printf("%d\n", ans);
  fclose(stdin);
  fclose(stdout);
  return 0;
}
