Editorial
Need a hint? Checkout the editorial.
View Editorial
Editorial
Surely odd numbers cannot remain as the final number as the sum is invariant mod 2.
Now, we show that every even number is attainable. For $1 \leq k \leq 2^7$,
$$(1,2k), (2,3), (4,5), \ldots, (2k-2,2k-1), (2k+1,2k+2), \ldots, (2^{8}-1, 2^{8}) $$
$$\Rightarrow 2k-1, 1, 1, \ldots, 1 \qquad \text{(note that there are an odd number of 1's)} $$
$$\Rightarrow (2k-1, 1), (1,1), (1,1), \ldots, (1,1) $$
$$\Rightarrow 2k-2, 0, 0, \ldots, 0 $$
$$\vdots $$
$$\Rightarrow 2k-2.$$