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.Arrays;
import java.util.Scanner;

public class E {

    static private final int MAX_PRIMES = 100000;
    static private long[] primes;

    static {
        primes = new long[MAX_PRIMES];
        primes[0] = 2;
        int count = 1;
        L1:
        for (int candidate = 3; count < MAX_PRIMES; candidate += 2) {
            for (int i = 0; primes[i] * primes[i] <= candidate; i++) {
                if (candidate % primes[i] == 0) continue L1;
            }
            primes[count++] = candidate;
        }
    }

    public void solve() {

        Scanner sc = new Scanner(System.in);
//        Scanner sc = new Scanner(
//                "4\n" +
//                "6 72 8 4\n");
//        Scanner sc = new Scanner(
//                "4\n" +
//                "2 4 8 16\n");
//        Scanner sc = new Scanner(
//                "4\n" +
//                "89377792582 425944344122 943396966542 964442994305\n");

        int n = sc.nextInt();

        long[] values = new long[n];
        for (int i = 0; i < values.length; i++) {
            values[i] = sc.nextLong();
        }
        Arrays.sort(values);
        for (int i = 0; i < values.length / 2; i++) {
            long t = values[values.length - i - 1];
            values[values.length - i - 1] = values[i];
            values[i] = t;
        }

        int[] decompositions = new int[values.length];
        for (int i = 0; i < values.length; i++) {
            long value = values[i];
            int d = 0;

            for (int j = 0; j < primes.length && primes[j] * primes[j] <= value; j++) {
                for (; value % primes[j] == 0; d++)
                    value /= primes[j];
            }
            if (value > 1) d++;

            decompositions[i] = d;
        }

        int primeValues = 0;
        for (int i = 0; i < decompositions.length; i++) {
            if (decompositions[i] == 1) primeValues++;
        }

        long[] rems = new long[values.length];
        int[] roots = new int[values.length];
        System.arraycopy(values, 0, rems, 0, values.length);

        int r = dfs(decompositions, primeValues, rems, roots, 0, 0);

        System.out.println(r);
    }

    private int dfs(int[] decompositions, int primeValues, long[] rems, int[] roots, int rootsCount, int edge) {
        if (edge < rems.length) {
            roots[rootsCount] = edge;
            int min = dfs(decompositions, primeValues, rems, roots, rootsCount + 1, edge + 1);

            for (int i = 0; i < edge; i++) {
                if (rems[i] % rems[edge] == 0) {
                    long t = rems[i];
                    rems[i] /= rems[edge];
                    min = Math.min(min, dfs(decompositions, primeValues, rems, roots, rootsCount, edge + 1));
                    rems[i] = t;
                }
            }

            return min;
        } else {
            int nodesCount = rootsCount > 1 ? rems.length + 1 : rems.length;

            int leafsCount = 0;
            for (int i = 0; i < rootsCount; i++) {
                leafsCount += decompositions[roots[i]];
            }

            return nodesCount + leafsCount - primeValues;
        }
    }

    public static void main(String[] args) {
        E solver = new E();
        solver.solve();
    }

}
