#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
const double PI = 2.0 * acos(0.0);
template <class T>
inline T MAX(T a, T b) {
  if (a > b) return a;
  return b;
}
template <class T>
inline T MIN(T a, T b) {
  if (a < b) return a;
  return b;
}
int n, res, parent[10];
vector<int> child[10];
long long a[10];
vector<pair<long long, long long> > Div[10];
bool used[1000111];
vector<int> listP;
void sang() {
  for (int i = (2), _b = (1000000); i <= _b; i++)
    if (!used[i]) {
      listP.push_back(i);
      int j = i + i;
      while (j <= 1000000) {
        used[j] = true;
        j += i;
      }
    }
}
void init() {
  for (int i = (1), _b = (n); i <= _b; i++) {
    long long x = a[i];
    for (int j = 0, _n = (listP.size()); j < _n; j++) {
      long long y = listP[j];
      int cnt = 0;
      while (x % y == 0) {
        cnt++;
        x /= y;
      }
      if (cnt) {
        Div[i].push_back(make_pair(y, cnt));
      }
    }
    if (x > 1) Div[i].push_back(make_pair(x, 1));
  }
}
void solve() {
  int cnt = 0;
  for (int i = (1), _b = (n); i <= _b; i++)
    if (parent[i] == 0) cnt++;
  if (cnt == 0) return;
  int total = n;
  if (cnt > 1) total += 1;
  for (int i = (1), _b = (n); i <= _b; i++) child[i].clear();
  for (int i = (1), _b = (n); i <= _b; i++) child[parent[i]].push_back(i);
  for (int i = (1), _b = (n); i <= _b; i++) {
    map<long long, long long> s;
    for (int j = 0, _n = (Div[i].size()); j < _n; j++) {
      long long u = Div[i][j].first;
      long long v = Div[i][j].second;
      s[u] += v;
    }
    for (int j = 0, _n = (child[i].size()); j < _n; j++) {
      int k = child[i][j];
      for (int l = 0, _n = (Div[k].size()); l < _n; l++) {
        long long u = Div[k][l].first;
        long long v = Div[k][l].second;
        s[u] -= v;
        if (s[u] < 0) {
          return;
        }
      }
    }
    if (child[i].size() == 0 && Div[i].size() == 1 && Div[i][0].second == 1) {
    } else
      for (__typeof((s).begin()) it = (s).begin(); it != (s).end(); it++)
        total += it->second;
  }
  if (total == 11) {
    {
      cerr << "parent"
           << " = ";
      for (int _ = (1), _b = (n); _ <= _b; _++) cerr << parent[_] << ' ';
      cerr << endl;
    };
  }
  res = min(res, total);
}
void att(int x) {
  if (x > n) {
    solve();
    return;
  }
  for (int i = (0), _b = (n); i <= _b; i++)
    if (i != x)
      if (i == 0 || a[i] % a[x] == 0) {
        parent[x] = i;
        att(x + 1);
      }
}
int main() {
  cin >> n;
  for (int i = (1), _b = (n); i <= _b; i++) cin >> a[i];
  sang();
  init();
  res = 1000111000;
  att(1);
  cout << res;
}
