#C1338. Skip One Level Game Strategy

    ID: 42911 Type: Default 1000ms 256MiB

Skip One Level Game Strategy

Skip One Level Game Strategy

You are playing a game consisting of N levels. In each level, you must fight a certain number of enemies. However, you are allowed to skip exactly one level in order to minimize the total number of enemies you have to fight.

Let \(B_1, B_2, \ldots, B_N\) denote the number of enemies in each level. If you skip the level with the maximum number of enemies, then the minimum total number of enemies you will have to fight is given by:

\[ \text{Result} = \sum_{i=1}^{N}B_i - \max_{1 \le i \le N}B_i \]

Your task is to compute and output this minimum total.

inputFormat

The input is given via standard input and consists of two lines:

  • The first line contains a single integer \(N\) representing the number of levels.
  • The second line contains \(N\) space-separated integers \(B_1, B_2, \ldots, B_N\) representing the number of enemies in each level.

outputFormat

Output a single integer, which is the minimum total number of enemies you will have to fight when you skip the level with the most enemies. The answer should be printed to standard output.

## sample
5
1 2 3 4 5
10