#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target( \
    "avx,avx2,fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
long long MOD = 1e9 + 7;
vector<long long> a;
vector<long long> prs;
long long n;
long long kol = 0;
long long get1(long long v, vector<long long> &tr) {
  if (tr.size() == n) {
    return prs[0] + n - kol;
  }
  long long ans = MOD;
  for (int i = 0; i < v; i++) {
    if (tr[i] % a[v] == 0) {
      tr[i] /= a[v];
      tr.push_back(a[v]);
      ans = min(ans, get1(v + 1, tr));
      tr.pop_back();
      tr[i] *= a[v];
    }
  }
  return (ans == MOD ? -1 : ans);
}
long long get2(long long v, vector<long long> &tr, long long mems) {
  if (tr.size() == n) {
    return n + 1 - kol + mems;
  }
  long long ans = MOD;
  for (int i = -1; i < v; i++) {
    if (i == -1) {
      tr.push_back(a[v]);
      ans = min(ans, get2(v + 1, tr, mems + prs[v]));
      tr.pop_back();
      continue;
    }
    if (tr[i] % a[v] == 0) {
      tr[i] /= a[v];
      tr.push_back(a[v]);
      ans = min(ans, get2(v + 1, tr, mems));
      tr.pop_back();
      tr[i] *= a[v];
    }
  }
  return (ans == MOD ? -1 : ans);
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0),
      cout << fixed << setprecision(20);
  cin >> n;
  a.resize(n);
  prs.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.rbegin(), a.rend());
  for (int i = 0; i < n; i++) {
    long long b = a[i];
    vector<long long> psk;
    for (long long j = 2; j * j <= a[i]; j++) {
      while (b % j == 0) {
        b /= j;
        prs[i]++;
      }
    }
    if (b != 1) {
      prs[i]++;
    }
    if (prs[i] == 1) {
      kol++;
    }
  }
  vector<long long> tr;
  tr.push_back(a[0]);
  long long ans = get2(1, tr, prs[0]);
  tr.clear();
  tr.push_back(a[0]);
  long long an = get1(1, tr);
  if (an != -1) {
    ans = min(an, ans);
  }
  cout << ans;
}
