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.*;

public class C {

    final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");



	Map<Long, Integer> map = new TreeMap<Long, Integer>();
	Set<Long> primes = new TreeSet<Long>();
	Set<Long> notPrimes = new TreeSet<Long>();

	boolean isPrime(long x){
		if(x == 1) return true;
		if(primes.contains(x)) {
			return true;
		}
		if(notPrimes.contains(x)) {
			return false;
		}
		for(long i = 2; i * i <= x; i++) {
			if(x % i == 0) {
				notPrimes.add(x);
				return false;
			}
		}
		primes.add(x);
		return true;
	}


    void solve() throws IOException {
		int n = readInt();
		numOfDiv = new int[n];

		long[] a = new long[n];
		for(int i = 0; i < n; i++) {
			a[i] = readLong();
		}
		for(int i = 0; i < n; i++) {
			numOfDiv[i] = numberOfPrimeDivizors(a[i]);
		}
		int[] p = new int[n];
		for(int i = 0; i < n; i++) {
			p[i] = i;
		}

		int min = Integer.MAX_VALUE;
		int c = 0;
		while(true) {
			c++;
			int cur = numberOfVertex(a, p);
			if(cur < min) {
				min = cur;
			}
			p = nextPermutation(p);
			if(p == null) {
				break;
			}
		}
		System.err.println(c);
		out.println(min);
    }

	int numberOfVertex(long[] a, int[] p) {
		used = new boolean[a.length];
		int res = 0;
		int component = 0;
		for(int i = 0; i < a.length; i++) {
			if(!used[i]) {
				int cur = dfs(i, a, p);
				if(isPrime(a[p[i]])) {
					res++;
				} else {
					res += cur+numOfDiv[p[i]];
				}

				component++;
			}
		}
		if(component != 1) {
			res +=1;
		}
		return res;

	}
	boolean[] used;

	int dfs(int x, long[] a, int[] p) {
		used[x] = true;
		if(x == p.length - 1) {
			int res =  numOfDiv[p[x]];
			if(isPrime(a[p[x]])){
				return 0;
			} else {
				return 1;
			}
		}
		int res = numOfDiv[p[x]];
		int count = 0;
		long curX = a[p[x]];
		for(int i = x + 1; i < p.length; i++) {
			if(curX % a[p[i]] == 0) {
				count += dfs(i,a,p);
				curX /= a[p[i]];
			} else {
				break;
			}
		}
		if(isPrime(a[p[x]])) {
			return 0;
		}
		return  count + 1;
	}

	int[] numOfDiv;

	int numberOfPrimeDivizors(long x) {
		if(x == 1) return 0;
		if(map.containsKey(x)) {
			return map.get(x);
		} else {
			long z = x;
			int count = 0;
			while(true) {
				if(z == 1) {
					break;
				}
				long del = -1;
				for(long i = 2; i * i <= z; i++) {
					if(z%i == 0) {
						del = i;
						break;
					}
				}
				if(del == -1) {
					del = z;
				}
				count++;
				z /= del;
			}
			map.put(x, count);
			return count;
		}
	}

	int[] nextPermutation(int[] p) {
		int[] res = new int[p.length];
		for(int i = 0; i < p.length; i++) {
			res[i] = p[i];
		}
		int k = -1;
		for(int i = 0; i < p.length-1; i++) {
			if(p[i] < p[i+1]) {
				k = i;
			}
		}
		if(k == -1) {
			return null;
		}
		int l = -1;
		for(int j = 0; j < p.length; j++) {
			if(p[k] < p[j]) {
				l = j;
			}
		}
		int temp = res[k];
		res[k] = res[l];
		res[l] = temp;
		p[k] = res[k];
		p[l] = res[l];
		if(k + 1 >= p.length-1) {
			return res;
		}
		for(int i = k+1; i < p.length; i++) {
			res[i] = p[p.length-1 - (i-(k+1))];
		}
		return res;
	}

    void init() throws FileNotFoundException {
        if (ONLINE_JUDGE) {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
        } else {
            in = new BufferedReader(new FileReader("input.txt"));
            out = new PrintWriter("output.txt");
        }
    }

    String readString() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine());
        }
        return tok.nextToken();
    }

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    int[] readArr(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = readInt();
        }
        return res;
    }

    long[] readArrL(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = readLong();
        }
        return res;
    }

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

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            init();
            solve();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }
}