#K40757. Highest Energy Knight
Highest Energy Knight
Highest Energy Knight
You are provided with a list of integers representing the energy levels of knights. The knights have a special power: if two knights share the same energy level, they can teleport together and merge, forming a single knight with energy equal to twice their original energy.
You may perform any number of teleportation operations. Your task is to determine the highest energy level that can be achieved by any knight after performing these adaptations.
Formally, if two knights both have energy \( x \), they merge into one knight with energy \( 2x \). This operation can be applied repeatedly in any order.
inputFormat
The input is read from stdin and consists of two lines.
- The first line contains a single integer \( n \) (\(1 \le n \le 10^5\)), the number of knights.
- The second line contains \( n \) space-separated integers representing the energy levels of the knights.
outputFormat
Print a single integer representing the maximum energy level achievable by any knight after all possible teleportation transformations. The output should be written to stdout.
## sample5
3 3 6 6 12
24
</p>