Codeforces Round 196 (Div. 1)
C
Divisor Tree
Codeforces
未评级
原题
← BD →
翻译中…

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 $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$. He tries to build a divisor tree which contains each of these numbers. That is, for each $*a*_{*i*}$, there should be at least one vertex in the tree which contains $*a*_{*i*}$. 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 $*a*_{*i*}$ ($2 ≤ *a*_{*i*} ≤ 10^{12}$).

翻译中…

Output

翻译中…

Print a single integer — the minimum number of vertices in the divisor tree that contains each of the numbers $*a*_{*i*}$.

翻译中…

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.

翻译中…

样例

Input #1
2
6 10
Output #1
7
InputCopy OutputCopy
Input #2
4
6 72 8 4
Output #2
12
InputCopy OutputCopy
Input #3
1
7
Output #3
1
InputCopy OutputCopy
题目信息
题号
338C
时间限制
0.5 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。