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>
using namespace std;
const long long MAX = (long long)1 << 61;
int ct, flag, rear, counter;
long long que[100000];
long long a[10];
long long nn;
long long Abs(long long n) {
  if (n < 0) return -n;
  return n;
}
long long multi(long long a, long long b, long long n) {
  long long exp = a % n, re = 0;
  while (b) {
    if (b & 1) {
      re += exp;
      if (re > n) re -= n;
    }
    exp <<= 1;
    if (exp > n) exp -= n;
    b >>= 1;
  }
  return re;
}
long long gcd(long long small, long long big) {
  while (small) {
    swap(small, big);
    small %= big;
  }
  return Abs(big);
}
long long random(long long n) {
  return (long long)(fabs((double)rand()) / RAND_MAX * n + 0.5);
}
long long quick_mod(long long a, long long p, long long m) {
  long long exp = a % m, re = 1;
  while (p > 1) {
    if (p & 1) re = multi(re, exp, m);
    exp = multi(exp, exp, m);
    p >>= 1;
  }
  return multi(re, exp, m);
}
long long pollard_rho(long long n, long long c) {
  long long x, y, d, i = 1, k = 2;
  x = random(n - 1) + 1;
  y = x;
  while (1) {
    i++;
    x = (multi(x, x, n) + c) % n;
    d = gcd(y - x, n);
    if (1 < d && d < n) return d;
    if (y == x) return n;
    if (i == k) {
      y = x;
      k = k << 1;
    }
  }
}
bool miller_rabin(long long n) {
  if (n == 2) return 1;
  if (n < 2 || !(n & 1)) return 0;
  long long a, u = n - 1, x, y;
  int t = 0;
  while (u % 2 == 0) {
    t++;
    u /= 2;
  }
  srand(time(0));
  for (int i = 0; i < 11; i++) {
    a = rand() % (n - 1) + 1;
    x = quick_mod(a, u, n);
    for (int j = 0; j < t; j++) {
      y = multi(x, x, n);
      if (y == 1 && x != 1 && x != n - 1) return false;
      x = y;
    }
    if (y != 1) return false;
  }
  return true;
}
void finds(long long n, int k) {
  if (n == 1) return;
  if (miller_rabin(n)) {
    que[++rear] = n;
    return;
  }
  long long p = n;
  while (p >= n) p = pollard_rho(p, k--);
  finds(p, k);
  finds(n / p, k);
}
bool cmp(long long aa, long long bb) { return aa > bb; }
vector<long long> f[10];
int pre[20];
int nxt[20];
map<long long, int> mp;
long long ans;
int num;
void dfs(int u) {
  if (u == num) {
    long long ret = num;
    for (int i = 0; i < num; i++) {
      int cnt = 0;
      if (mp.find(a[i]) != mp.end())
        cnt = mp[a[i]];
      else {
        long long tmp = a[i];
        rear = 0;
        finds(tmp, 201);
        cnt = rear;
        mp[a[i]] = cnt;
      }
      if (cnt == 1) {
        if (nxt[i] != 0) ret += cnt;
      } else
        ret += cnt;
    }
    for (int i = 1; i < num; i++) {
      if (pre[i] == -1) {
        ret++;
        break;
      }
    }
    ans = min(ans, ret);
    return;
  }
  for (int i = 0; i < u; i++) {
    if (a[i] % a[u] == 0) {
      a[i] /= a[u];
      pre[u] = i;
      int temp = nxt[i];
      nxt[i] = u;
      dfs(u + 1);
      nxt[i] = temp;
      a[i] *= a[u];
    }
  }
  pre[u] = -1;
  dfs(u + 1);
}
void init() {
  for (int i = 0; i < num; i++) f[i].clear();
  mp.clear();
  memset(pre, -1, sizeof(pre));
  memset(nxt, 0, sizeof(nxt));
}
int main() {
  ios::sync_with_stdio(false);
  cin >> num;
  {
    ans = 0x3f3f3f3f;
    init();
    for (int i = 0; i < num; i++) {
      cin >> a[i];
    }
    sort(a, a + num, cmp);
    dfs(0);
    cout << ans << endl;
  }
  return 0;
}
