There are 25 in total, chapter select works fine because the game autosaves as soon as you collect one hat. Below is helpful video to aid you.
Make sure to leave annotations on because the video provider made a mistake on one of the hat locations, he corrected this in form of an annotation.
Credit to TheDisturbedG1 for the video.