#K57092. Tournament Winner
Tournament Winner
Tournament Winner
You are given a list of positive integers representing the skill levels of players in a tournament. In each round, players are paired (the list length is guaranteed to be a power of 2), and in each pair, the player with the higher skill level wins and advances to the next round. This process continues until only one player remains. Your task is to simulate this tournament and determine the skill level of the final winner.
The tournament follows the rule:
\( \text{winner} = \max({a_{2i}}, {a_{2i+1}}) \) for all valid pairs \( i \) in each round.
Make sure to read the input from standard input and write the result to standard output.
inputFormat
The first line contains an integer \( n \) (the number of players, which is a power of 2). The second line contains \( n \) space-separated positive integers representing the skill levels of the players.
outputFormat
Output a single integer, the skill level of the final winner after the tournament simulation.
## sample8
3 5 7 2 1 4 6 8
8