Collapse transition for isolated square-well chain molecules: The exact density of states for short chains