Max xor profit problem


there is something wrong with my logic