As a response to the lack of energy resources, a large number of factories were installed on the margins of the rivers when the use of the water turbine widespread. Usually, the factories included a Company town; Catalonia has a high density of this kind of settlements, known locally as industrial colonies ("colònies industrials"). They are especially concentrated in river basins along the Ter and Llobregat. In the comarca of Berguedà, for example, within 20 km there are 14 colonies. These were small towns created around a factory, built in a rural area and, therefore, separate from any other population. They housed between 100 and 500 inhabitants, and in some cases around 1000 people. These industrial colonies were a typical aspect of industrialization in Catalonia, specifically the second industrialization, which resulted in certain areas that were once purely rural becoming industrial. They were first created in the second half of the nineteenth century, especially from the 1870s onwards. The last colonies were created in the early years of the twentieth century. There are more than 75 textile colonies recorded; although there were also mining, metallurgy and agricultural colonies.