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.
//package codeforces186;



import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;

public class Main {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        E2 solver = new E2();
        int testCount = 1;
        for (int i = 1; i <= testCount; i++) {
            solver.solve(i, in, out);
        }
        out.close();
    }
}

class E2 {
    
    ArrayList<Long> tree = new ArrayList<Long>();
    
    int[] primeSum;
    
    int primes;

    public void solve(int testNumber, InputReader in, OutputWriter out) {
     
        int n = in.readInt();
        
        primeSum = new int[n];
        
        long[] arr = new long[n];
        for( int i = 0; i < n; i++){
          arr[i] = Long.parseLong(in.readString()); 
        }
        
        for( int i = 0; i < n; i++){
          for( int j = 0; j < i; j++ ){
             if(arr[i] > arr[j]){
                arr[i] = arr[i]^arr[j];
                arr[j] = arr[i]^arr[j];
                arr[i] = arr[i]^arr[j];
             }
          }
        }
        
        for (int i = 0; i < arr.length; i++) {
            primeSum[i] = getPrimeSum(arr[i]);
            if(primeSum[i] == 1)
                primes++;
        }

        if (n == 1) {
            if (primeSum[0] == 1) {
                out.printLine(1);
            } else {
                out.printLine(primeSum[0] + 1);
            }
            return;
        }
        
             
        tree.add((long)0);
        
        out.printLine(get_answer(0, arr, tree, 0, 0));   
    }
    
    public long get_answer( int cur ,  long[] arr , ArrayList<Long> tree , int  m , int o){
    
        if( cur == arr.length)
            return o + (( m > 1)?1:0) + arr.length - primes;
        
        long best = 1000000000;
        
        for( int i = 0; i < tree.size(); i++){
          if(tree.get(i) % arr[cur] == 0){
              tree.set(i, tree.get(i)/arr[cur]); 
              tree.add(arr[cur]); 
              best = Math.min( best , get_answer(cur+1, arr, tree, m + ((i == 0)?1:0), o + (i == 0 ? primeSum[cur] : 0)));  
              tree.set(i, tree.get(i)*arr[cur]); 
              tree.remove(tree.size()-1);
          }
        }
        
        return best;
    }
    
    public int getPrimeSum(long num) {
        int start = 2;
        int result = 0;
        while (start <= Math.sqrt(num)) {
            while (num % start == 0) {
                result++;
                num /= start;
            }
            start++;
        }

        if (num > 1) {
            result++;
        }
        return result;
    }
    

}

class InputReader {

    private InputStream stream;
    private byte[] buf = new byte[1024];
    private int curChar;
    private int numChars;
    private SpaceCharFilter filter;

    public InputReader(InputStream stream) {
        this.stream = stream;
    }

    public int read() {
        if (numChars == -1) {
            throw new InputMismatchException();
        }
        if (curChar >= numChars) {
            curChar = 0;
            try {
                numChars = stream.read(buf);
            } catch (IOException e) {
                throw new InputMismatchException();
            }
            if (numChars <= 0) {
                return -1;
            }
        }
        return buf[curChar++];
    }

    public int readInt() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        int sgn = 1;
        if (c == '-') {
            sgn = -1;
            c = read();
        }
        int res = 0;
        do {
            if (c < '0' || c > '9') {
                throw new InputMismatchException();
            }
            res *= 10;
            res += c - '0';
            c = read();
        } while (!isSpaceChar(c));
        return res * sgn;
    }

    public String readString() {
        int c = read();
        while (isSpaceChar(c)) {
            c = read();
        }
        StringBuilder res = new StringBuilder();
        do {
            res.appendCodePoint(c);
            c = read();
        } while (!isSpaceChar(c));
        return res.toString();
    }

    public boolean isSpaceChar(int c) {
        if (filter != null) {
            return filter.isSpaceChar(c);
        }
        return isWhitespace(c);
    }

    public static boolean isWhitespace(int c) {
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

    public String next() {
        return readString();
    }

    public interface SpaceCharFilter {

        public boolean isSpaceChar(int ch);
    }
}

class OutputWriter {

    private final PrintWriter writer;

    public OutputWriter(OutputStream outputStream) {
        writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public OutputWriter(Writer writer) {
        this.writer = new PrintWriter(writer);
    }

    public void print(Object... objects) {
        for (int i = 0; i < objects.length; i++) {
            if (i != 0) {
                writer.print(' ');
            }
            writer.print(objects[i]);
        }
    }

    public void printLine(Object... objects) {
        print(objects);
        writer.println();
    }

    public void close() {
        writer.close();
    }
}

class IOUtils {

    public static int[] readIntArray(InputReader in, int size) {
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = in.readInt();
        }
        return array;
    }
}
