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.io.*;
import java.util.*;
import java.math.*;

public class C implements Runnable {
	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer st;
	static Random rnd;

	private void solve() throws IOException {
		int numbersCount = nextInt();
		long[] numbers = new long[numbersCount];
		for (int i = 0; i < numbersCount; i++)
			numbers[i] = nextLong();
		Arrays.sort(numbers);
		arraysReverse(numbers);

		rec(0, numbersCount, numbers, new boolean[numbersCount], 0, 0,
				new long[numbersCount], new boolean[numbersCount]);

		out.println(result);
	}

	private void arraysReverse(long[] numbers) {
		int l = 0, r = numbers.length - 1;
		while (l < r) {
			long temp = numbers[l];
			numbers[l] = numbers[r];
			numbers[r] = temp;
			++l;
			--r;
		}
	}

	int result = Integer.MAX_VALUE;

	private void rec(int step, int numbersCount, long[] numbers,
			boolean[] used, int treesNearRoot, int treesCount,
			long[] treesRoots, boolean[] isLeaf) {
		int currentVertexes = getVertexes(treesNearRoot, treesCount,
				treesRoots, isLeaf);

		// out.println(currentVertexes + " " + result + " " + step + " "
		// + treesNearRoot + " " + treesCount + " "
		// + Arrays.toString(treesRoots));

		if (currentVertexes >= result)
			return;

		if (step == numbersCount) {
			result = Math.min(result, currentVertexes);
		} else {
			for (int i = step; i <= step; i++) {
				if (!used[i]) {
					used[i] = true;
					long number = numbers[i];
					boolean end = false;

					// add tree
					{
						treesRoots[treesCount] = number;
						isLeaf[treesCount] = true;
						rec(step + 1, numbersCount, numbers, used,
								treesNearRoot + 1, treesCount + 1, treesRoots,
								isLeaf);

						if (currentVertexes >= result)
							end = true;
					}

					// add to another tree
					for (int j = 0; j < treesCount && !end; j++) {
						if (treesRoots[j] % number == 0) {
							treesRoots[j] /= number;
							boolean backUpIsLeaf = isLeaf[j];
							isLeaf[j] = false;
							treesRoots[treesCount] = number;
							isLeaf[treesCount] = true;

							rec(step + 1, numbersCount, numbers, used,
									treesNearRoot, treesCount + 1, treesRoots,
									isLeaf);

							treesRoots[j] *= number;
							isLeaf[j] = backUpIsLeaf;

							if (currentVertexes >= result)
								end = true;
						}
					}

					used[i] = false;
				}
			}
		}
	}

	private int getVertexes(int treesNearRoot, int treesCount,
			long[] treesRoots, boolean[] isLeaf) {
		int vertexes = (treesNearRoot > 1 ? 1 : 0);
		for (int i = 0; i < treesCount; i++) {
			int childs = getPrimes(treesRoots[i]);
			int add = (childs <= 1 && isLeaf[i]) ? 1 : (1 + childs);
			vertexes += add;
		}
		return vertexes;
	}

	Map<Long, Integer> cache = new HashMap<Long, Integer>();

	private int getPrimes(long n) {
		if (n == 1)
			return 0;
		Integer cacheValue = cache.get(n);
		if (cacheValue != null)
			return cacheValue;
		int result = 1;
		for (long i = 2; i * i <= n; i++) {
			if (n % i == 0) {
				result = 1 + getPrimes(n / i);
				break;
			}
		}
		cache.put(n, result);
		return result;
	}

	public static void main(String[] args) {
		new C().run();
	}

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);

			rnd = new Random();

			solve();

			out.close();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	private String nextToken() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			String line = in.readLine();

			if (line == null)
				return null;

			st = new StringTokenizer(line);
		}

		return st.nextToken();
	}

	private int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	private long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	private double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}