Money detector with counting function