The name Livorna is mentioned for the first time in 1017 as one small coastal village, the port and the remains of a roman tower. In 1077 a tower was built by Matilda of Tuscany. The Republic of Pisa owned Livorno since 1103 and built there a quadrangular Fort called Quadratura dei Pisani (Quartered of the Pisans) at defence of the port. Porto Pisano was destroyed after the crushing defeat of the Pisan fleet in the Battle of Meloria in 1248. Livorno was bought in 1399 by the Visconti of Milan, then was sold to the Republic of Genoa in 1405 and afterwards was bought definitively from Florence on August 28, 1421. 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 personnel, and the homeless were not included in the census. In 1551 the population was 1,562 residents, in 1745 it had risen to 32,534 and in 1861 at the unification was 96,471 inhabitants. The only remainder of medieval Livorno is a fragment of two towers and a wall, located inside the Fortezza Vecchia.