Halving a positive number removes its least significant binary digit. Thus vertex must participate in exactly moves, where is the number of binary digits of .
Write those digits from least significant to most significant. This sequence records the parity of the vertex before each of its moves. Do not add leading zeros: after the last digit is consumed, the vertex disappears.
Let be the longest common subsequence length of these two digit sequences. If adjacent vertices are selected together several times, the corresponding parities form a common subsequence. Consequently, they can share at most moves.