Instructions
Go the courtyard at the bottom of the clock tower.
Target the statues surrounding fountain and press "X" to break them apart with blasts of magic.
Target the resultant bricks and press "B" to cast the Wingardium Leviosa spell. This will assemble a groundskeeper who unclogs the fountain.
Collect the red brick that appears. Now whenever Nearly Headless Nick escorts you through the Hogwarts, you'll be able to collect the ghost studs he leaves behind.