#P1120. [CERC 1995] 小木棍

[CERC 1995] 小木棍

Description

George has some small wooden sticks of equal length. He randomly cut these sticks into several pieces until each piece had length no more than 5050.

Now he wants to reassemble the sticks to their original form, but he has forgotten how many sticks he started with and what their lengths were.

Given the lengths of all the pieces, write a program to find the minimal possible length of the original sticks.

Input Format

The first line contains an integer nn, the number of stick pieces.
The second line contains nn integers, the lengths aia_i of the pieces.

Output Format

Output a single integer on one line, representing the answer.

9
5 2 1 5 2 1 5 2 1

6

Hint

For all testdata, 1n651 \leq n \leq 65, 1ai501 \leq a_i \leq 50.

Translated by ChatGPT 5