#include <bits/stdc++.h>
using namespace std;
struct comp1 {
  bool operator()(const long long &a, const long long &b) { return (a > b); }
};
typedef struct node {
  long long num;
  vector<node *> des;
} node;
int n;
long long arr[8];
int best;
node *root;
vector<node *> imp;
bool prime[1000000 + 1];
set<long long> primes;
int breakInto(long long num) {
  if (num == 0) return 0;
  int cnt = 0;
  for (set<long long>::iterator i = primes.begin(); i != primes.end(); i++) {
    while (num % (*i) == 0) {
      cnt++;
      num /= (*i);
    }
    if (num == 1) break;
  }
  return cnt;
}
int count(node *curr) {
  int cnt = 0;
  if (curr->des.size() == 0) {
    int ret = breakInto(curr->num);
    if (ret == 1)
      return 1;
    else
      return ret + 1;
  }
  cnt = 1 + breakInto(curr->num);
  for (int i = 0; i < curr->des.size(); i++) cnt += count(curr->des[i]);
  return cnt;
}
void print(node *curr) {
  cout << curr->num << ":";
  for (int i = 0; i < curr->des.size(); i++) print(curr->des[i]);
}
void recurse(int i) {
  if (i == 0) {
    root = new node();
    root->num = arr[0];
    imp.push_back(root);
    recurse(i + 1);
    root->num = 0;
    node *nnode = new node();
    nnode->num = arr[0];
    root->des.push_back(nnode);
    imp.push_back(nnode);
    recurse(i + 1);
    return;
  }
  if (i == n) {
    best = min(best, count(root));
    return;
  }
  for (int j = 0; j < imp.size(); j++) {
    long long nnum = imp[j]->num;
    if (nnum % arr[i] == 0) {
      node *nnode = new node();
      nnode->num = arr[i];
      imp[j]->des.push_back(nnode);
      imp.push_back(nnode);
      imp[j]->num /= arr[i];
      recurse(i + 1);
      imp[j]->num *= arr[i];
      imp[j]->des.pop_back();
      imp.pop_back();
    }
  }
}
void precompute(void) {
  for (int i = 0; i <= 1000000; i++) prime[i] = 1;
  prime[0] = prime[1] = 0;
  for (int i = 2; i * i <= 1000000; i++) {
    for (int j = i * i; j <= 1000000; j += i) prime[j] = 0;
  }
}
int main() {
  best = 1000;
  root = NULL;
  precompute();
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%I64d", &arr[i]);
  sort(arr, arr + n, comp1());
  for (int i = 0; i < n; i++) {
    long long num = arr[i];
    for (long long j = 2; j * j <= num; j++) {
      if (prime[j]) {
        while (num % j == 0) {
          primes.insert(j);
          num /= j;
        }
      }
      if (num == 1) break;
    }
    if (num > 1) primes.insert(num);
  }
  recurse(0);
  printf("%d\n", best);
  return 0;
}
