#include <bits/stdc++.h>
using namespace std;
long long N, A[10];
long long pfcnt[10];
vector<long long> comb[10];
vector<long long> targ[1 << 9];
vector<long long> cost[1 << 9];
long long dp[1 << 9][1 << 9];
long long popcount(long long c) {
  long long ret = 0;
  for (long long i = 0; i < N; i++) {
    if (c & (1 << i)) {
      ret++;
    }
  }
  return ret;
}
void upd(long long &x, long long y) { x = min(x, y); }
void preprocess() {
  scanf("%I64d", &N);
  for (long long i = 0; i < N; i++) {
    scanf("%I64d", &A[i]);
  }
  sort(A, A + N);
  N = unique(A, A + N) - A;
  for (long long c = 0; c < (1 << N); c++) {
    comb[popcount(c)].push_back(c);
  }
  for (long long i = 0; i < N; i++) {
    long long X = A[i];
    for (long long j = 2; j < 1000020; j++) {
      while (X % j == 0) {
        X /= j;
        pfcnt[i]++;
      }
    }
    if (X != 1) pfcnt[i]++;
  }
  for (long long c = 0; c < (1 << N); c++) {
    for (long long tar = 0; tar < N; tar++) {
      bool good = 1;
      long long X = A[tar];
      long long VAL = pfcnt[tar];
      for (long long i = 0; i < N; i++) {
        if (c & (1 << i)) {
          if (X % A[i] == 0) {
            X /= A[i];
            VAL -= pfcnt[i];
          } else
            good = 0;
        }
      }
      if (good) {
        targ[c].push_back(tar);
        cost[c].push_back(VAL);
      }
    }
  }
  for (long long i = 0; i < (1 << N); i++) {
    for (long long j = 0; j < (1 << N); j++) {
      dp[i][j] = 999999999;
    }
  }
  for (long long id = 0; id < N; id++) {
    if (pfcnt[id] == 1)
      dp[1 << id][1 << id] = 1;
    else
      dp[1 << id][1 << id] = pfcnt[id] + 1;
  }
}
void solve() {
  for (long long popc = 1; popc < N; popc++) {
    for (__typeof((comb[popc]).begin()) it = (comb[popc]).begin();
         it != (comb[popc]).end(); it++) {
      for (long long c = 1; c < (1 << N); c++) {
        if (dp[*it][c] == 999999999) continue;
        for (long long x = 0; x < ((long long)(targ[c]).size()); x++) {
          long long tar = targ[c][x];
          long long cst = dp[*it][c] + cost[c][x] + 1;
          upd(dp[*it | (1 << tar)][1 << tar], cst);
        }
      }
      for (long long i = 0; i < N; i++) {
        if (dp[*it][1 << i] == 999999999) continue;
        for (long long c1 = 1; c1 < (1 << N); c1++) {
          for (long long c2 = 1; c2 < (1 << N); c2++) {
            long long val = dp[c1][c2] + dp[*it][1 << i];
            upd(dp[c1 | *it][c2 | (1 << i)], val);
          }
        }
      }
    }
  }
  long long ans = 999999999;
  for (long long c = 1; c < (1 << N); c++) {
    if (popcount(c) == 1) {
      upd(ans, dp[(1 << N) - 1][c]);
    } else {
      upd(ans, dp[(1 << N) - 1][c] + 1);
    }
  }
  printf("%I64d\n", ans);
}
int main() {
  preprocess();
  solve();
}
