#K42237. Predict the Champion of a Single-Elimination Tournament

    ID: 27043 Type: Default 1000ms 256MiB

Predict the Champion of a Single-Elimination Tournament

Predict the Champion of a Single-Elimination Tournament

In this problem, you are given the number of players and their distinct skill levels. In a single-elimination tournament, players are paired in each round. In each round, the players are first sorted in descending order by their skill levels. Then, players are paired sequentially for a match, and the winner of each match is the one with the greater skill level. If there is an odd number of players, the unmatched player advances automatically to the next round. This process continues until a single champion remains. The goal is to determine the skill level of the champion.

( \textbf{Input:} ) The first line contains an integer ( n ) that denotes the number of players. The second line contains ( n ) distinct integers representing the skill levels of the players.

( \textbf{Output:} ) Output a single integer representing the skill level of the champion.

inputFormat

The input consists of two lines. The first line contains a single integer ( n ) (( 1 \leq n \leq 10^5 )), denoting the number of players. The second line contains ( n ) space-separated integers, where each integer represents the distinct skill level of a player.

outputFormat

Print a single integer, the skill level of the champion.## sample

4
1500 2000 1800 1700
2000