#include <bits/stdc++.h>
using namespace std;
const int MaxN = 8, logA = 40;
long long int A[MaxN], B[MaxN], N, cant[MaxN], Bc[MaxN], costo;
int primos(long long int x) {
  long long int i, j, p, q, w = 0;
  for (i = 2; i * i <= x; i++)
    while (x % i == 0) w++, x /= i;
  if (x > 1) w++;
  return w;
}
long long int posible(int pos) {
  if (pos == N) return (costo > 1);
  long long int mini = 1000000;
  for (int i = pos + 1; i < N; i++) {
    if (B[i] % A[pos] == 0) {
      B[i] /= A[pos];
      Bc[i] -= cant[pos];
      mini = min(mini, posible(pos + 1) + Bc[pos]);
      B[i] *= A[pos];
      Bc[i] += cant[pos];
    }
  }
  costo++;
  mini = min(mini, posible(pos + 1) + Bc[pos]);
  costo--;
  return mini;
}
int main() {
  int i, j, p, q, w;
  cin >> N;
  for (i = 0; i < N; i++) cin >> A[i];
  sort(A, A + N);
  for (i = 0; i < N; i++) {
    w = primos(A[i]);
    B[i] = A[i];
    Bc[i] = w + (w > 1);
    cant[i] = w;
  }
  cout << posible(0) << "\n";
}
