#include <bits/stdc++.h>
using namespace std;
long long a[10];
int cnt[10];
bool vis[10];
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v;
  for (int i = 0; i < n; i++) scanf("%lld", &a[i]), v.emplace_back(i);
  for (int i = 0; i < n; i++) {
    long long x = a[i];
    for (long long j = 2; j * j <= a[i]; j++) {
      while (x % j == 0) {
        cnt[i]++;
        x /= j;
      }
    }
    if (x > 1) cnt[i]++;
  }
  int ans = 1e9;
  do {
    memset(vis, 0, sizeof(vis));
    int res = 0;
    for (int i = 0; i < v.size(); i++) {
      long long x = a[v[i]];
      int c = cnt[v[i]];
      if (c == 1) {
        res++;
        continue;
      }
      for (int j = i - 1; j >= 0; j--) {
        if (vis[j]) continue;
        if (x % a[v[j]] == 0) {
          x /= a[v[j]];
          c -= cnt[v[j]];
          vis[j] = 1;
        }
      }
      res += c + 1;
    }
    int cnt = 0;
    for (int i = 0; i < v.size(); i++)
      if (!vis[i]) cnt++;
    if (cnt != 1) res++;
    ans = min(ans, res);
  } while (next_permutation(v.begin(), v.end()));
  printf("%d\n", ans);
}
