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;
int n;
long long a[8];
int factors[8];
int primeCnt;
int solve(int cur, vector<long long> &tree, int rootNum, int rootSum) {
  if (cur == n) return n + (rootNum > 1) + rootSum - primeCnt;
  int ret = 1 << 28;
  for (int i = 0; i < (int)(tree.size()); i++) {
    if (tree[i] % a[cur] == 0) {
      tree.push_back(a[cur]);
      tree[i] /= a[cur];
      ret = min(ret, solve(cur + 1, tree, rootNum + (i == 0),
                           rootSum + (i == 0) * factors[cur]));
      tree[i] *= a[cur];
      tree.pop_back();
    }
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  sort(a, a + n, greater<long long>());
  for (int i = 0; i < (int)(n); i++) {
    long long tmp = a[i];
    for (int j = 2; (long long)j * j <= tmp; j++) {
      while (tmp % j == 0) {
        factors[i]++;
        tmp /= j;
      }
    }
    if (tmp > 1) factors[i]++;
    if (tmp == a[i]) primeCnt++;
  }
  vector<long long> tree;
  tree.push_back(0);
  int ret = solve(0, tree, 0, 0);
  cout << ret << endl;
  return 0;
}
