Let $a_1,a_2,\cdots,a_{2n+1}$ be integers such that, if any one of them is removed, the remaining ones can be divided into two sets of $n$ integers with equal sum. Prove $a_1 = a_2 = \cdots = a_{2n+1}$
$Note:-$ The solution is mentioned in this website - https://www.fmf.uni-lj.si/~lavric/Santos%20-%20Number%20Theory%20for%20Mathematical%20Contests.pdf.
I understood the first three lines of the solution but however from the fourth line, I couldn't understand, why are all $a_k$ congruent mod $4$ ?
THE PROOF FROM THE WEBSITE - "As the sum of the $2n$ integers remaining is always even, no matter which of the $a_k$ be taken, all the $a_k$ must have the same parity. The property stated in the problem is now shared by $a_k/2$ or ($a_k −1$)/$2$, depending on whether they are all even, or all odd. Thus they are all congruent mod $4$. Continuing in this manner we arrive at the conclusion that the $a_k$ are all congruent mod $2^k$ for every $k$, and this may only happen if they are all equal."