#include <bits/stdc++.h>
using namespace std;
double PI = acos(-1);
double EPS = 1e-7;
int INF = 1000000000;
int MOD = 1000000007;
int MAXINT = 2147483647;
long long INFLL = 1000000000000000000LL;
long long MAXLL = 9223372036854775807LL;
int mx[8] = {-1, 1, 0, 0, -1, -1, 1, 1};
int my[8] = {0, 0, -1, 1, -1, 1, -1, 1};
long long x[10];
map<long long, int> memo;
int go(int pos, vector<pair<long long, int> > tree) {
  if (pos == 0) {
    int ret = 0;
    for (int(a) = (0); (a) <= ((int)tree.size() - 1); (a)++) {
      long long num = tree[a].first;
      int cur = 0;
      if (num) {
        if (memo.count(num))
          cur = memo[num];
        else {
          for (int(b) = (2); (b) <= (sqrt(num) + 1); (b)++) {
            while (num % b == 0) {
              num /= b;
              cur++;
            }
          }
          if (num != 1) cur++;
          memo[tree[a].first] = cur;
        }
        if (cur != 1)
          ret += cur;
        else
          ret += 1 - tree[a].second;
      }
    }
    return ret;
  }
  int ret = INF;
  for (int(a) = (0); (a) <= ((int)tree.size() - 1); (a)++) {
    if (tree[a].first % x[pos] == 0) {
      vector<pair<long long, int> > tmp = tree;
      if (tmp[a].first / x[pos] != 1) {
        tmp.push_back(make_pair(tmp[a].first / x[pos], 0));
      }
      tmp[a].first = x[pos];
      tmp[a].second = 1;
      (ret) = min((ret), (1 + go(pos - 1, tmp)));
    }
  }
  return ret;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int(a) = (1); (a) <= (n); (a)++) {
    scanf("%I64d", &x[a]);
  }
  sort(x + 1, x + n + 1);
  vector<pair<long long, int> > v;
  v.push_back(make_pair(0, 1));
  int ans = 1 + go(n, v);
  v.pop_back();
  v.push_back(make_pair(x[n], 1));
  (ans) = min((ans), (1 + go(n - 1, v)));
  printf("%d\n", ans);
}
