logo AlgoBeat OnlineJudge
登录 注册

#215134. [ICPC 2024 Chengdu R] Magical Set

内存限制:1024 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

You have a magical set that initially contains distinct integers. You discover that these numbers can generate energy by dividing into their factors. In each step, you can select any number greater than from the set, remove it, and insert one of its factors. The factor you insert must not be equal to the original number. Additionally, due to the instability of the magical set, your operation must ensure that the numbers in the set remain distinct.

Each operation generates one unit of energy, and your goal is to maximize the total energy generated by performing as many operations as possible. Given the initial numbers in the set, determine the maximum amount of energy that can be generated, i.e., the maximum number of operations that can be performed.

输入格式

The first line contains an integer (), indicating the number of integers in the initial set.

The second line contains distinct integers (), representing the numbers in the initial set.

输出格式

Output a single integer indicating the maximum amount of energy that can be generated, i.e., the maximum number of operations that can be performed.

样例

样例输入 1

3
2 4 6

样例输出 1

3

样例输入 2

6
2 3 5 6 10 12

样例输出 2

3