跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F2342. Divisor Tree

    ID: 2348 传统题 2000ms 256MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>枚举数论算法思想数学数据结构提高难度共享题库Codeforces英文题面题目来源题面语言

Divisor Tree

题目描述

E. Divisor Tree
time limit per test
0.5 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

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:

Sample 2. In this case you can build the following divisor tree:

Sample 3. Note that the tree can consist of a single vertex.


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 1964 题。保留原作者与原赛事署名。