#K77677. Maximum Team Strength

    ID: 34918 Type: Default 1000ms 256MiB

Maximum Team Strength

Maximum Team Strength

You are given an integer n and a list of n integers representing the skill levels of students. Your task is to form a team of three students such that their combined skill level is maximized. In other words, you need to choose three students with the highest skill levels.

The answer can be mathematically represented as:

$$\text{maxTeamStrength} = a_{(1)} + a_{(2)} + a_{(3)}$$

where \(a_{(1)}\), \(a_{(2)}\), \(a_{(3)}\) are the three largest values in the list of skill levels.

Note: The input is provided via standard input and the output should be printed to standard output.

inputFormat

The first line contains an integer n (\(n \geq 3\)), the number of students. The second line contains n space-separated integers that represent the skill levels of the students.

outputFormat

Output a single integer, which is the maximum combined strength of any team of three students.

## sample
5
10 20 30 40 50
120