题目描述
Problem Description
Yamunaku-kun came up with a game using a piece of paper and an integer sequence of length $N$, $A_1, A_2, \ldots, A_N$.
First, write any positive integer on the paper. Then perform $N$ operations. In the $i$-th operation $(1 \le i \le N)$, do one of the following:
- Let $X$ be the number currently written on the paper. Compute $Y = \left\lfloor \frac{A_i}{X} \right\rfloor$ (where $\lfloor x \rfloor$ denotes the integer part of $x$). Replace the number on the paper with $Y$ and gain $Y$ points. Note that this operation cannot be performed if $X > A_i$.
- Do nothing. No points are gained.
Yamunaku-kun wants to maximize the total score obtained from $N$ operations.
Find the maximum score Yamunaku-kun can achieve by optimally choosing the initial number on the paper and performing the $N$ operations.
Input Format
The input is given from the standard input in the following format:
$N$ $A_1$ $A_2$ $\ldots$ $A_N$
Output Format
Output the maximum score Yamunaku-kun can achieve in one line.
Sample Input and Output
Sample Input #1
3
3 6 9
Sample Output #1
10
Sample Input #2
3
10 3 4
Sample Output #2
10
Sample Input #3
1
1000
Sample Output #3
1000
Sample Input #4
10
87 72 55 81 12 59 1 10 18 53
Sample Output #4
166
Notes/Hints
Constraints
- $1 \le N \le 1000$
- $1 \le A_i \le 10^6$
- All inputs are integers.
Partial Points
This problem has partial points.
- Correctly solving the problem for inputs where $A_i \le 1000$ for all $i (1 \le i \le N)$ will award $300$ points.
Sample Explanation 1
- First, write $2$ on the paper.
- In the 1st operation, replace the number on the paper with $\left\lfloor \frac{3}{2} \right\rfloor = 1$ and gain $1$ point.
- In the 2nd operation, do nothing.
- In the 3rd operation, replace the number on the paper with $\left\lfloor \frac{9}{1} \right\rfloor = 9$ and gain $9$ points.
The total score is $10$, which is the maximum. Note that there are other ways to achieve $10$ points.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
3
3 6 9
样例输出
10