#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
int n;
vector<long long> v1;
int index1[10];
int answer1 = INT_MAX;
vector<long long> Adj[10];
int prime1[10];
void recurse(int max1, int length) {
  if (length == n) {
    int temp1 = 0;
    for (int(i) = (0); (i) < (max1 + 1); ++(i)) {
      Adj[i].clear();
    }
    int count1 = 0;
    bool poss1 = true;
    for (int(i) = (0); (i) < (n); ++(i)) {
      if (Adj[index1[i]].empty()) {
        count1++;
        Adj[index1[i]].push_back(v1[i]);
        temp1 += prime1[i];
        if (prime1[i] != 1) {
          temp1++;
        }
      } else {
        long long remove1 = -1;
        long long add1 = v1[i];
        for (int(j) = (0); (j) < (Adj[index1[i]].size()); ++(j)) {
          if (Adj[index1[i]][j] % v1[i] == 0) {
            temp1 += 1;
            if (prime1[i] == 1) {
              temp1--;
            }
            remove1 = Adj[index1[i]][j];
            break;
          }
        }
        if (remove1 != -1) {
          sort(Adj[index1[i]].begin(), Adj[index1[i]].end());
          reverse(Adj[index1[i]].begin(), Adj[index1[i]].end());
          Adj[index1[i]].erase(std::remove(Adj[index1[i]].begin(),
                                           Adj[index1[i]].end(), remove1),
                               Adj[index1[i]].end());
          Adj[index1[i]].push_back(add1);
          Adj[index1[i]].push_back(remove1 / add1);
          sort(Adj[index1[i]].begin(), Adj[index1[i]].end());
          reverse(Adj[index1[i]].begin(), Adj[index1[i]].end());
        } else {
          poss1 = false;
        }
      }
    }
    if (count1 >= 2) {
      temp1++;
    }
    if (poss1) {
      answer1 = min(answer1, temp1);
    }
  } else {
    for (int(i) = (0); (i) < (max1 + 2); ++(i)) {
      index1[length] = i;
      recurse(max(i, max1), length + 1);
    }
  }
}
int main() {
  scanf("%d", &n);
  for (int(i) = (0); (i) < (n); ++(i)) {
    long long temp;
    scanf("%lld", &temp);
    v1.push_back(temp);
  }
  sort(v1.begin(), v1.end());
  reverse(v1.begin(), v1.end());
  for (int(i) = (0); (i) < (n); ++(i)) {
    long long temp1 = v1[i];
    for (long long j = 2; (long long)j * j <= temp1; j++) {
      while (temp1 % j == 0) {
        prime1[i] += 1;
        temp1 = temp1 / j;
      }
    }
    if (temp1 > 1) {
      prime1[i] += 1;
    }
  }
  index1[0] = 0;
  recurse(0, 1);
  printf("%d\n", answer1);
  return 0;
}
