#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n;
ll a[10];
int p[10];
int primes[10];
int ans = 1e9;
bool check() {
  ll par_value[10];
  for (int i = 0; i <= n; ++i) {
    par_value[i] = 1;
  }
  for (int i = 1; i <= n; ++i) {
    if (p[i] == 0) {
      continue;
    }
    if ((double)par_value[p[i]] * (double)a[i] > 1e18) {
      return 0;
    }
    par_value[p[i]] *= a[i];
  }
  for (int i = 1; i <= n; ++i) {
    if (a[i] % par_value[i] != 0) {
      return 0;
    }
  }
  return 1;
}
void go(int x) {
  if (x == n + 1) {
    if (!check()) return;
    int children[10];
    for (int i = 0; i <= n; ++i) {
      children[i] = 0;
    }
    for (int i = 1; i <= n; ++i) {
      children[p[i]]++;
    }
    int c = n;
    for (int i = 1; i <= n; ++i) {
      if (p[i] == 0) {
        c += primes[i];
      } else if (primes[i] == 0) {
        c--;
      }
    }
    if (children[0] > 1) {
      c++;
    }
    ans = min(ans, c);
    cerr << ans << endl;
    return;
  }
  for (int i = 0; i <= n; ++i) {
    if (a[i] % a[x] == 0 && i != x) {
      p[x] = i;
      go(x + 1);
    }
  }
}
int count(ll x) {
  int c = 0;
  for (ll p = 2; p * p <= x; ++p) {
    while (x % p == 0) {
      x /= p;
      c++;
    }
  }
  if (x > 1) {
    c++;
  }
  return c;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  for (int i = 1; i <= n; ++i) {
    primes[i] = count(a[i]);
    if (primes[i] == 1) {
      primes[i] = 0;
    }
  }
  go(1);
  cout << ans << endl;
  return 0;
}
