{"raw_statement":[{"iden":"problem statement","content":"$2^N$ players, labeled $1$ through $2^N$, will compete against each other in a single-elimination programming tournament.  \nThe rating of Player $i$ is $A_i$. Any two players have different ratings, and a match between two players always results in the victory of the player with the higher rating.\nThe tournament looks like a perfect binary tree.  \nFormally, the tournament will proceed as follows:\n\n*   For each integer $i = 1, 2, 3, \\dots, N$ in this order, the following happens.\n    *   For each integer $j (1 \\le j \\le 2^{N - i})$, among the players who have never lost, the player with the $(2j - 1)$\\-th smallest label and the player with the $2j$\\-th smallest label play a match against each other.\n\nFind the label of the player who will take **second place**, that is, lose in the final match."},{"iden":"constraints","content":"*   $1 \\le N \\le 16$\n*   $1 \\le A_i \\le 10^9$\n*   $A_i$ are pairwise different.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$A_1$ $A_2$ $A_3$ $\\dots$ $A_{2^N}$"},{"iden":"sample input 1","content":"2\n1 4 2 5"},{"iden":"sample output 1","content":"2\n\nFirst, there will be two matches between Players $1$ and $2$ and between Players $3$ and $4$. According to the ratings, Players $2$ and $4$ will win.  \nThen, there will be a match between Players $2$ and $4$, and the tournament will end with Player $4$ becoming champion.  \nThe player who will lose in the final match is Player $2$, so we should print $2$."},{"iden":"sample input 2","content":"2\n3 1 5 4"},{"iden":"sample output 2","content":"1\n\nFirst, there will be two matches between Players $1$ and $2$ and between Players $3$ and $4$. According to the ratings, Players $1$ and $3$ will win.  \nThen, there will be a match between Players $1$ and $3$, and the tournament will end with Player $3$ becoming champion.  \nThe player who will lose in the final match is Player $1$, so we should print $1$."},{"iden":"sample input 3","content":"4\n6 13 12 5 3 7 10 11 16 9 8 15 2 1 14 4"},{"iden":"sample output 3","content":"2"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}