The money left after the first time is 2x-24.
The remaining money for the second time is 2(2x-24)-24.
The remaining money for the third time is 0=2(2(2x-24)-24)-24.
Solve the third equation to get x=2 1.