This is not a cryptography but a communication systems challenge that referred to Hamming code Error Detection. It XOR the index of ones (actually, index + 1) in binary representation of each block of message and save the result number (parity) with the block.
We get the saved parity (as last_parity), calculate the parity and with those, we can calculate the fliped bit as follow:
> index_of_fliped_bit = (parity ^ last_parity) - 1