#include <bits/stdc++.h>
using namespace std;
const int maxN = 10;
int n;
long long a[maxN], b[maxN];
int c[maxN], p[maxN];
int res = 1000000000;
int get(long long b) {
  if (b == 0) return 0;
  int ans = 0;
  for (long long x = 2; x * x <= b; x++)
    if (b % x == 0) {
      while (b % x == 0) {
        ans++;
        b /= x;
      }
    }
  if (b > 1) ans++;
  if (ans == 1) ans = 0;
  return ans;
}
void check() {
  for (int i = 1; i <= n; i++) b[i] = a[i];
  for (int i = 1; i <= n; i++)
    if (p[i] <= n)
      if (b[p[i]] % a[i])
        return;
      else
        b[p[i]] /= a[i];
  int ans = 0;
  for (int i = 1; i <= n; i++)
    if (p[i] > n)
      ans += c[i] + 1;
    else if (p[i] <= n && c[i] > 0)
      ans += 1;
  int cnt = 0;
  for (int i = 1; i <= n; i++)
    if (p[i] > n) cnt++;
  if (cnt >= 2) ans++;
  if (ans < res) {
    res = ans;
  }
}
void attempt(int i) {
  if (i > n) {
    check();
    return;
  }
  for (int j = i + 1; j <= n + 1; j++) {
    p[i] = j;
    attempt(i + 1);
  }
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++) c[i] = get(a[i]);
  attempt(1);
  cout << res;
  return 0;
}
