We’re preparing your current view and syncing the latest data.
Skibidus owns several fanums, each with its own tax. The task is to minimize the total tax paid by applying certain rules defined in the problem. In the easy version, constraints are simpler, making the problem more approachable.
The first line contains a single integer n, the number of fanums. The second line contains n integers representing the tax values of each fanum.
Print the minimum total tax Skibidus has to pay.
1 ≤ n ≤ 1000 Tax values ≤ 10^6
Example 1
Input
5 1 2 3 4 5
Output
6
Explanation
By applying the tax rules from the problem, the minimum total tax can be calculated as 6 for the given fanums.