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 int max_n = 8 + 2;
int n, m, ans = 1000, fl;
vector<long long> vec;
vector<long long> sec[max_n];
vector<int> child[max_n];
void get(int ind) {
  if (ind >= n) {
    int ret = fl + bool(fl > 1);
    for (int i = 0; i < n; i++) {
      ret += child[i].size();
      long long t = sec[i].size(), x = 1;
      for (int j : child[i]) {
        x *= vec[j];
        t -= sec[j].size();
        if (x > vec[i]) return;
      }
      if (vec[i] % x) return;
      ret += t;
    }
    ans = min(ans, ret - m);
    return;
  }
  for (int i = -1; i < ind; i++) {
    if (i == -1) fl++;
    if (i != -1) child[i].push_back(ind);
    get(ind + 1);
    if (i != -1) child[i].pop_back();
    if (i == -1) fl--;
  }
}
int main() {
  scanf("%d", &n);
  vec.resize(n);
  for (int i = 0; i < n; i++) scanf("%I64d", &vec[i]);
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for (int i = 0; i < vec.size(); i++) {
    long long temp = vec[i];
    for (long long j = 2; temp != 1; j++) {
      if (j * j > temp) {
        sec[i].push_back(temp);
        break;
      }
      while (temp % j == 0) {
        temp /= j;
        sec[i].push_back(j);
      }
    }
    if (sec[i].size() == 1) m++;
  }
  get(0);
  printf("%d\n", ans);
  return 0;
}
