human
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: 

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

Sample 3. Note that the tree can consist of a single vertex.
Using cpp can you solve the prior task?
assistant
#Here is Python code to determine the minimum possible number of vertices in the divisor tree sought.

#include <bits/stdc++.h>
using namespace std;
int N;
long long A[8];
int dp[8][1 << 8];
int use[1 << 8];
int yaku(long long x) {
  int res = 0;
  long long def = x;
  for (long long i = 2; i * i <= x; i++)
    if (x % i == 0) {
      while (x % i == 0) res++, x /= i;
    }
  if (x != 1 && x != def) res++;
  return res;
}
bool is_prime(long long x) {
  for (long long i = 2; i * i <= x; i++)
    if (x % i == 0) {
      return false;
    }
  if (x == 1) return false;
  return true;
}
int main() {
  scanf("%d", &N);
  for (int(i) = 0; (i) < (N); (i)++) scanf("%I64d", &A[i]);
  sort(A, A + N);
  for (int(i) = 0; (i) < (N); (i)++)
    for (int(j) = 0; (j) < (1 << N); (j)++) dp[i][j] = (1 << 30);
  dp[0][1] = yaku(A[0]) + 1;
  for (int(i) = (1); (i) < (N); (i)++) {
    for (int(j) = 0; (j) < (1 << i); (j)++) {
      use[j] = (1 << 30);
      long long lcm = 1;
      for (int(k) = 0; (k) < (N); (k)++)
        if (j >> k & 1) {
          double ff = double(lcm) * A[k];
          if (ff > 1e14) {
            lcm = (1LL << 60);
            break;
          }
          lcm = lcm * A[k];
        }
      if (lcm < (1LL << 60) && A[i] % lcm == 0)
        use[j] = yaku(A[i] / lcm) + (lcm != 1 && is_prime(A[i] / lcm)) + 1;
    }
    for (int(j) = 0; (j) < (1 << N); (j)++)
      if (dp[i - 1][j] < (1 << 30))
        for (int(k) = 0; (k) < (1 << i); (k)++)
          if (((~j) & k) == 0 && use[k] < (1 << 30)) {
            dp[i][(j & (~k)) | (1 << i)] =
                min(dp[i][(j & (~k)) | (1 << i)], dp[i - 1][j] + use[k]);
          }
  }
  int ans = (1 << 30);
  for (int(i) = 0; (i) < (N); (i)++) ans = min(ans, dp[N - 1][1 << i]);
  for (int(i) = 0; (i) < (1 << N); (i)++) ans = min(ans, dp[N - 1][i] + 1);
  printf("%d\n", ans);
}