#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
const int mod = (int)1e9 + 7;
int n, m, k;
int p[100000], pnt = 0;
map<long long, int> g[8], G[8];
vector<long long> f[8];
int w[8];
long long a[8];
int ans, Ans, mm;
void Do(int u) {
  if (u == n) {
    Ans = min(Ans, ans + (mm < n - 1));
    return;
  }
  if (w[u] > 1) ans += 1;
  ans += w[u];
  Do(u + 1);
  ans -= w[u];
  for (int v = (u + 1); v <= (n - 1); v++) {
    bool ok = 1;
    for (__typeof((f[u]).begin()) y = (f[u]).begin(); y != (f[u]).end(); y++)
      if (G[u][*y] > g[v][*y]) {
        ok = 0;
        break;
      }
    if (!ok) continue;
    for (__typeof((f[u]).begin()) y = (f[u]).begin(); y != (f[u]).end(); y++)
      g[v][*y] -= G[u][*y];
    mm++;
    Do(u + 1);
    for (__typeof((f[u]).begin()) y = (f[u]).begin(); y != (f[u]).end(); y++)
      g[v][*y] += G[u][*y];
    mm--;
  }
  if (w[u] > 1) ans -= 1;
}
void In() {
  for (int i = 0; i < (1000000); i++)
    if (i > 1) {
      p[pnt++] = i;
      for (int j = 2; j * j <= i; j++)
        if (i % j == 0) {
          pnt--;
          break;
        }
    }
  scanf("%d", &n);
  ;
  for (int i = 0; i < (n); i++) cin >> a[i];
  sort(a, a + n);
  for (int i = 0; i < (n); i++) {
    long long x = a[i];
    for (int j = 0; j < (pnt); j++)
      if (x > 1) {
        if (x % p[j] == 0) f[i].push_back(p[j]);
        while (x % p[j] == 0) {
          x /= p[j];
          g[i][p[j]]++;
          G[i][p[j]]++;
          w[i]++;
        }
      }
    if (x > 1) {
      G[i][x] = g[i][x] = 1, w[i]++, f[i].push_back(x);
    }
  }
}
int main() {
  In();
  mm = ans = 0, Ans = mod;
  Do(0);
  cout << Ans;
  return 0;
}
