#include <bits/stdc++.h>
using namespace std;
int n;
int M[10][10];
set<long long> S[16];
int pai[16];
int resp;
vector<int> fat[16];
long long v[16];
int calc(int ans) {
  int cnt = 0;
  for (int i = 0; i < n; i++)
    if (pai[i] == -1) cnt++;
  if (cnt > 1) return ans + 1;
  return ans;
}
bool pode(int i, int j) {
  long long x = v[j];
  for (set<long long>::iterator it = S[j].begin(); it != S[j].end(); it++) {
    x /= (v[*it]);
  }
  return x % v[i] == 0;
}
void bruta(int pos, int ans) {
  if (pos == n) {
    resp = min(resp, calc(ans));
    return;
  }
  bruta(pos + 1, ans);
  for (int j = 0; j < n; j++)
    if (j != pos) {
      if (pode(pos, j)) {
        S[j].insert(pos);
        pai[pos] = j;
        bruta(pos + 1, ans - fat[pos].size());
        S[j].erase(S[j].find(pos));
        pai[pos] = -1;
      }
    }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n; i++) {
    long long x = v[i];
    for (long long j = 2; j * j <= x; j++) {
      while (x % j == 0) {
        x /= j;
        fat[i].push_back(j);
      }
    }
    if (x != 1) fat[i].push_back(x);
  }
  memset(pai, -1, sizeof pai);
  int ans = 0;
  for (int i = 0; i < n; i++) {
    ans += fat[i].size();
    if (fat[i].size() != 1) ans++;
  }
  resp = (1 << 29);
  bruta(0, ans);
  cout << resp << endl;
  return 0;
}
