#include <bits/stdc++.h>
using namespace std;
int n;
long long a[20], b[20];
long long tempa[20];
void mergesort(long long *a, int n1, int n2);
void f(int p);
int ans;
int ps[80100], np, z[1000100];
int qq;
void f(int p) {
  int i;
  int temp;
  long long bb;
  int j;
  if (p == n) {
    temp = 0;
    for (i = 1; i <= n; i++) {
      bb = b[i];
      j = 1;
      while (bb != 1) {
        if (!(bb % ps[j])) {
          temp++;
          bb /= ps[j];
        } else {
          j++;
        }
        if (j > np) {
          break;
        }
      }
      if (bb != 1) {
        temp++;
      }
    }
    if (qq != n) {
      temp++;
    }
    if (temp < ans) {
      ans = temp;
    }
  } else {
    for (i = p + 1; i <= n; i++) {
      if (!(b[i] % a[p])) {
        b[i] /= a[p];
        qq++;
        f(p + 1);
        qq--;
        b[i] *= a[p];
      }
    }
    f(p + 1);
  }
}
void mergesort(long long *a, int n1, int n2) {
  int a1, a2, n12;
  int i, j;
  if (n1 < n2) {
    n12 = (n1 + n2) / 2;
    mergesort(a, n1, n12);
    mergesort(a, n12 + 1, n2);
    for (i = n1; i <= n2; i++) {
      tempa[i] = a[i];
    }
    a1 = n1;
    a2 = n12 + 1;
    for (i = n1; (a1 <= n12 && a2 <= n2); i++) {
      if (tempa[a1] <= tempa[a2]) {
        a[i] = tempa[a1];
        a1++;
      } else {
        a[i] = tempa[a2];
        a2++;
      }
    }
    if (a1 > n12) {
      for (j = a2; j <= n2; j++, i++) {
        a[i] = tempa[j];
      }
    } else {
      for (j = a1; j <= n12; j++, i++) {
        a[i] = tempa[j];
      }
    }
  }
}
int main(void) {
  int i, j;
  long long aa;
  int zz;
  for (i = 3; i <= 1000000; i += 2) {
    z[i] = 1;
    z[i + 1] = 0;
  }
  z[2] = 1;
  z[1] = 0;
  np = 1;
  ps[1] = 2;
  for (i = 3; i <= 1000; i += 2) {
    if (z[i]) {
      ps[++np] = i;
      for (j = i * i; j <= 1000000; j += i) {
        z[j] = 0;
      }
    }
  }
  for (i = i; i <= 1000000; i += 2) {
    if (z[i]) {
      ps[++np] = i;
    }
  }
  while (scanf("%d", &n) != EOF) {
    for (i = 1; i <= n; i++) {
      scanf("%I64d", &a[i]);
    }
    mergesort(a, 1, n);
    for (i = 1; i <= n; i++) {
      b[i] = a[i];
    }
    ans = 2000000000;
    qq = 1;
    f(1);
    for (i = 1; i <= n; i++) {
      if (a[i] <= 1000000) {
        if (!z[a[i]]) {
          ans++;
        }
      } else {
        zz = 0;
        aa = a[i];
        for (j = 1; j <= np; j++) {
          if (!(aa % ps[j])) {
            zz = 1;
            break;
          }
        }
        if (zz) {
          ans++;
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
