#include <bits/stdc++.h>
using namespace std;
int n;
long long a[10];
long long aleft[10];
int chfact[10];
int fcount[10];
int best;
int singleton;
int ff(long long x) {
  long long ox = x;
  int c = 0;
  long long fff = 2;
  while (x != 1) {
    if (x % fff == 0) {
      x /= fff;
      c++;
    } else
      fff++;
    if (fff * fff > ox) fff = x;
  }
  return c;
}
void check_best() {
  int c1 = 0;
  for (int i = 0; i < n; i++)
    if (fcount[i] != 1) c1 += fcount[i] - chfact[i];
  c1 += n;
  if (singleton != 1) c1++;
  if (c1 < best) best = c1;
}
void tryat(int i) {
  if (i == -1) {
    check_best();
    return;
  }
  singleton++;
  tryat(i - 1);
  singleton--;
  for (int j = i + 1; j < n; j++)
    if (aleft[j] % a[i] == 0) {
      aleft[j] /= a[i];
      chfact[j] += fcount[i];
      tryat(i - 1);
      chfact[j] -= fcount[i];
      aleft[j] *= a[i];
    }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  best = 0;
  for (int i = 0; i < n; i++) {
    fcount[i] = ff(a[i]);
    aleft[i] = a[i];
    chfact[i] = 0;
    if (fcount[i] != 1) best += fcount[i];
  }
  best += n;
  if (n != 1) best++;
  singleton = 0;
  tryat(n - 1);
  cout << best << endl;
}
