A divisor tree is a rooted tree that meets the following conditions: 

  * Each vertex of the tree contains a positive integer number. 
  * The numbers written in the leaves of the tree are prime numbers. 
  * For any inner vertex, the number within it is equal to the product of the numbers written in its children. 



Manao has n distinct integers a1, a2, ..., an. He tries to build a divisor tree which contains each of these numbers. That is, for each ai, there should be at least one vertex in the tree which contains ai. Manao loves compact style, but his trees are too large. Help Manao determine the minimum possible number of vertices in the divisor tree sought.

Input

The first line contains a single integer n (1 ≤ n ≤ 8). The second line contains n distinct space-separated integers ai (2 ≤ ai ≤ 1012).

Output

Print a single integer — the minimum number of vertices in the divisor tree that contains each of the numbers ai.

Examples

Input

2
6 10


Output

7


Input

4
6 72 8 4


Output

12


Input

1
7


Output

1

Note

Sample 1. The smallest divisor tree looks this way: <image>

Sample 2. In this case you can build the following divisor tree: <image>

Sample 3. Note that the tree can consist of a single vertex.
#include <bits/stdc++.h>
const int li[] = {-1, 0, 1, 0};
const int lj[] = {0, -1, 0, 1};
using namespace std;
const int N = 1000;
long long edge[10][N], edgenum[10], num[10], nn[10];
long long arr[10];
int cnt;
const int S = 20;
long long mult_mod(long long a, long long b, long long c) {
  a %= c;
  b %= c;
  long long ret = 0;
  while (b) {
    if (b & 1) {
      ret += a;
      ret %= c;
    }
    a <<= 1;
    if (a >= c) a %= c;
    b >>= 1;
  }
  return ret;
}
long long pow_mod(long long x, long long n, long long mod) {
  if (n == 1) return x % mod;
  x %= mod;
  long long tmp = x;
  long long ret = 1;
  while (n) {
    if (n & 1) ret = mult_mod(ret, tmp, mod);
    tmp = mult_mod(tmp, tmp, mod);
    n >>= 1;
  }
  return ret;
}
bool check(long long a, long long n, long long x, long long t) {
  long long ret = pow_mod(a, x, n);
  long long last = ret;
  for (int i = 1; i <= t; i++) {
    ret = mult_mod(ret, ret, n);
    if (ret == 1 && last != 1 && last != n - 1) return true;
    last = ret;
  }
  if (ret != 1) return true;
  return false;
}
bool Miller_Rabin(long long n) {
  if (n < 2) return false;
  if (n == 2) return true;
  if ((n & 1) == 0) return false;
  long long x = n - 1;
  long long t = 0;
  while ((x & 1) == 0) {
    x >>= 1;
    t++;
  }
  for (int i = 0; i < S; i++) {
    long long a = rand() % (n - 1) + 1;
    if (check(a, n, x, t)) return false;
  }
  return true;
}
long long factor[100];
int tol;
long long gcd(long long a, long long b) {
  if (a == 0) return 1;
  if (a < 0) return gcd(-a, b);
  while (b) {
    long long t = a % b;
    a = b;
    b = t;
  }
  return a;
}
long long Pollard_rho(long long x, long long c) {
  long long i = 1, k = 2;
  long long x0 = rand() % x;
  long long y = x0;
  while (1) {
    i++;
    x0 = (mult_mod(x0, x0, x) + c) % x;
    long long d = gcd(y - x0, x);
    if (d != 1 && d != x) return d;
    if (y == x0) return x;
    if (i == k) {
      y = x0;
      k += k;
    }
  }
}
void findfac(long long n) {
  if (Miller_Rabin(n)) {
    factor[tol++] = n;
    return;
  }
  long long p = n;
  while (p >= n) p = Pollard_rho(p, rand() % (n - 1) + 1);
  findfac(p);
  findfac(n / p);
}
void makeprime(long long n, int id) {
  tol = 0;
  findfac(n);
  num[id] += tol;
  if (Miller_Rabin(n)) num[id] -= 1;
}
void show(int id) { cout << num[id] << "  num " << endl; }
int n;
bool vis[10];
void INIT() {
  memset(vis, 0, sizeof(vis));
  memset(edgenum, 0, sizeof(edgenum));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j)
      if (i != j) {
        if (arr[j] % arr[i] == 0) edge[i][edgenum[i]++] = j, vis[j] = true;
      }
  }
}
int ans;
bool flag[10];
int minn;
int every[10][10];
void dfs(long long t, long long cnt, long long tot, int k) {
  if (t == cnt) {
    if (k > 1) tot++;
    minn = minn < tot ? minn : tot;
    return;
  }
  if (minn <= tot) return;
  int id;
  for (int tt = 0; tt < n; ++tt) {
    if (!flag[tt]) {
      id = tt;
      flag[tt] = true;
      int tttt = 1;
      for (int i = 0; i < edgenum[id]; ++i) {
        if (flag[edge[id][i]]) continue;
        long long it = 1;
        for (int j = 0; j < n; ++j)
          if (every[edge[id][i]][j]) {
            it *= arr[j];
          }
        if (it > 10000000 && arr[id] > 10000000) continue;
        it *= arr[id];
        if (arr[edge[id][i]] % it) {
          continue;
        }
        tttt = 0;
        every[edge[id][i]][id] = true;
        nn[edge[id][i]] -= (num[id]);
        dfs(t + 1, cnt, tot + nn[id], k);
        every[edge[id][i]][id] = false;
        nn[edge[id][i]] += (num[id]);
      }
      if (tttt) {
        int nnn = 0;
        if (!num[id]) nnn++;
        dfs(t + 1, cnt, tot + nn[id] + nnn, k + 1);
      }
      flag[tt] = false;
    }
  }
}
void DO() {
  memset(flag, 0, sizeof(flag));
  memset(every, 0, sizeof(every));
  minn = 1 << 29;
  for (int i = 0; i < 10; ++i) nn[i] = num[i];
  dfs(0, n, 0, 0);
}
bool cmp(int a, int b) { return a > b; }
int main() {
  while (~scanf("%d", &n)) {
    for (int i = 0; i < n; ++i) {
      scanf("%lld", &arr[i]);
    }
    for (int i = 0; i < n; ++i) {
      makeprime(arr[i], i);
    }
    INIT();
    DO();
    for (int i = 0; i < n; ++i)
      if (num[i]) minn++;
    printf("%d\n", minn);
  }
  return 0;
}
