#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const double eps = 1e-8;
const int nm = 300005;
int n, k, m, t;
int res = MOD;
long long a[10];
int sl[10];
int tong;
struct Node {
  int stt;
  long long red;
  vector<Node*> con;
  Node() { stt = red = 0; }
  Node(int x, long long y) {
    stt = x;
    red = y;
  }
  void Set(int x, long long y) {
    stt = x;
    red = y;
  }
};
int s[10];
Node root;
int Find(Node* p) {
  int i, re = 0;
  Node* q;
  for (i = 0; i < p->con.size(); i++) {
    q = p->con[i];
    re += sl[q->stt];
    re += Find(q);
  }
  return re;
}
void Check() {
  Node* p = &root;
  if (root.stt != 0)
    res = min(res, tong - Find(p));
  else {
    int i, re = 0;
    for (i = 0; i < root.con.size(); i++) {
      re += Find(root.con[i]);
    }
    res = min(res, tong + 1 - re);
  }
}
void Try(int stt, Node* p) {
  int i, j;
  if (stt > n) {
    Check();
    return;
  }
  for (i = 0; i < p->con.size(); i++) {
    Try(stt, p->con[i]);
  }
  if (p->red % a[stt] == 0) {
    Node* q = new Node(stt, a[stt]);
    p->con.push_back(q);
    p->red /= a[stt];
    Try(stt + 1, &root);
    p->con.pop_back();
    p->red *= a[stt];
  }
}
int main() {
  int i, j;
  long long x, y, u, v, z;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1, greater<long long>());
  for (i = 1; i <= n; i++) {
    x = a[i];
    y = sqrt(x);
    for (u = 2; u <= y; u++) {
      while (x % u == 0) {
        sl[i]++;
        x /= u;
      }
    }
    if (x > 1) sl[i]++;
  }
  if (n == 1) {
    if (sl[1] > 1)
      cout << sl[1] + 1;
    else
      cout << 1;
    return 0;
  }
  tong = n;
  for (i = 1; i <= n; i++)
    if (sl[i] > 1) tong += sl[i];
  res = tong + 1;
  root.Set(1, a[1]);
  Node* p = &root;
  Try(2, p);
  root.Set(0, 0);
  Try(1, p);
  cout << res;
  return 0;
}
