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.
import java.util.Scanner;
import java.io.OutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Sabelan
 */
public class Main {
	public static void main(String[] args) {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		Scanner in = new Scanner(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskE {
  int n;

  int[][] factorsSaved;

  public void solve(int testNumber, Scanner in, PrintWriter out) {
    n = in.nextInt();
    long[] arr = new long[n];
    for (int i = 0; i < n; i++) {
      arr[i] = in.nextLong();
    }
    int factorSum = 0;
    int[] factors = new int[n];
    for (int i = 0; i < n; i++) {
      long c = arr[i];
      for (int j = 2; j <= 1000000 && j < c; j++) {
        while (c % j == 0) {
          c /= j;
          factors[i]++;
        }
      }
      if (c != 1 && c != arr[i])
        factors[i]++;

      factorSum += factors[i];
    }
    factorsSaved = new int[n][1 << n];
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < (1 << n); j++) {
        boolean works = true;
        long c = arr[i];
        int fsSaved = 0;
        for (int k = 0; k < n; k++) {
          if ((j & (1 << k)) != 0) {
            if (c % arr[k] == 0) {
              c /= arr[k];
              if (factors[k] == 0) fsSaved++;
              fsSaved += factors[k];
            } else {
              works = false;
            }
          }
        }
        factorsSaved[i][j] = works ? fsSaved : -1;
      }
    }

    memo = new int[n][1 << n];
    for (int[] a : memo) {
      Arrays.fill(a, -1);
    }

    int save = go(0, 0);
    out.printf("%d\n", n + factorSum + 1 - save);
  }

  int[][] memo;

  public int go(int at, int haveParent) {
    if (Integer.bitCount(haveParent) == n - 1) return 1;
    if (at == n) return 0;
    if (memo[at][haveParent] != -1) return -1;

    int max = Math.max(0, go(at + 1, haveParent));
    int iMask = ((1 << n) - 1) ^ haveParent;
    iMask &= ~(1 << at);
    for (int mask2 = iMask; mask2 > 0; mask2 = (mask2 - 1) & iMask) {
      if (factorsSaved[at][mask2] != -1) {
        max = Math.max(max, factorsSaved[at][mask2] + go(at + 1, haveParent | mask2));
      }
    }

    return memo[at][haveParent] = max;
  }
}

