Problem

Source: 2016 Saudi Arabia IMO TST , level 4, I p2

Tags: combinatorics



Given a set of $2^{2016}$ cards with the numbers $1,2, ..., 2^{2016}$ written on them. We divide the set of cards into pairs arbitrarily, from each pair, we keep the card with larger number and discard the other. We now again divide the $2^{2015}$ remaining cards into pairs arbitrarily, from each pair, we keep the card with smaller number and discard the other. We now have $2^{2014}$ cards, and again divide these cards into pairs and keep the larger one in each pair. We keep doing this way, alternating between keeping the larger number and keeping the smaller number in each pair, until we have just one card left. Find all possible values of this final card.