Livorno was founded in 1017 as one of small fortresses along the coast which were protecting Pisa. It belonged to the city of Pisa for several hundred years. However, the port serving Pisa was not Livorno but Porto Pisano, destroyed after the hard defeat of the Pisan fleet in the Battle of Meloria. Between 1404 and 1421, Livorno belonged to Genoa, and on August 28, 1421 it was sold to Florence. Between 1427 and 1429, the census was held. According to the results of the census, there were 118 families in Livorno, which made 423 persons. Monks, Jews, military, and homeless were not included in the census. The only remainder of the Medieval Livorno is a fragment of two towers and a wall, located inside the Old Fort. After the arrival of the Medicis, the ruling dynasty of Florence, some modifications were made, in particular, the Old Fort (Fortezza Vecchia) was constructed between 1518 and 1534, and the voluntary resettlement of the population to Livorno was stimulated, but Livorno still remained a rather insignificant coastal fortress.