#include <bits/stdc++.h>
using namespace std;
int n;
long long int a[8];
bool used[8];
map<long long int, int> counts;
int countpd(long long int x) {
  auto it = counts.find(x);
  if (it != counts.end()) {
    return it->second;
  }
  long long int y = x;
  int res = 0;
  for (long long int i = 2; i * i <= x; i++) {
    while (x % i == 0) {
      x /= i;
      res++;
    }
  }
  if (x != 1) res++;
  counts[y] = res;
  return res;
}
map<long long int, bool> primes;
bool isprime(long long int x) {
  auto it = primes.find(x);
  if (it != primes.end()) {
    return it->second;
  }
  bool res = true;
  for (long long int i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      res = false;
      break;
    }
  }
  primes[x] = res;
  return res;
}
int razves(int v) {
  used[v] = true;
  long long int x = a[v];
  if (isprime(x)) return 1;
  int res = 1;
  for (int i = 0; i < n; ++i) {
    if (!used[i] && x % a[i] == 0) {
      x /= a[i];
      res += razves(i);
    }
  }
  res += countpd(x);
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  int minans = 1e9;
  do {
    memset(used, 0, sizeof(used));
    int rounds = 0;
    int ans = 0;
    for (int i = 0; i < n; ++i) {
      if (!used[i]) {
        rounds++;
        ans += razves(i);
      }
    }
    if (rounds > 1) ans++;
    minans = min(ans, minans);
  } while (next_permutation(a, a + n));
  printf("%d\n", minans);
  puts("");
  return 0;
}
